package cn.edu.text;
/**
* 数组倒置
*/
public class ArrayRe {
public static <T> T[] arrayre(T[] o){ for (int i = 0; i < o.length/2; i++) { T tem = o[i]; o[i] = o[o.length-1-i]; o[o.length - 1 -i] = tem; } return o; } public static void main(String[] args) { String a[] = {"1","2","3","5","8","10","13"}; String b[] = arrayre(a); for (int i = 0; i < b.length; i++) { System.out.print(b[i]+" "); } } }
原文链接:https://www.f2er.com/javaschema/286209.html