反转给定数组的顺序。
public class Main { /** * Reverses the order of the given array. * * @param array * the array to reverse */ public static <E> void reverseArray(E[] array) { /* NowJava.com - 时代Java 提供 */ int i = 0; int j = array.length - 1; E tmp; while (j > i) { tmp = array[j]; array[j] = array[i]; array[i] = tmp; j--; i++; } } }