@Test
public void demo1() {
int[] arr = { 1, 2, 3, 4, 5 };
for (int start = 0, end = arr.length - 1; start < end; start++, end--) {
int temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
}
for (int i : arr) {
System.out.println(i);
}
时间: 2024-10-08 01:56:01