package review01; import java.util.Arrays; public class review01 { public static void main(String[] args) { method(); } private static void method() { // 数组逆序存储 int[] arr = { 2, 0, 1, 6, 1, 2, 0, 7, 2, 0, 1, 2, 3, 3 }; for (int s = 0, e = arr.length - 1; s < e; s++, e--) { int t = arr[s]; arr[s] = arr[e]; arr[e] = t; } System.out.println(Arrays.toString(arr)); } }
时间: 2024-10-05 15:36:56