代码实现:将一个数组逆序输出。

//将一个数组逆序输出。
public class Test {
	public static void main(String[] args) {
		int[] a = {1,2,3,4,5,6,7,8,9};
		for (int i = 0; i < a.length/2; i++) {
			int temp = a[i];
			a[i] = a[a.length-1-i];
			a[a.length-1-i] = temp;
		}
		for (int i : a) {
			System.out.print(i+" ");
		}
	}

}
原文地址:https://www.cnblogs.com/loaderman/p/6527501.html