package day5;
public class fanzhuanjiaohuan {
public static void main(String[] args) {
int[] arr = {
11,22,3,4,5};
reverse(arr);
printArrarry(arr);
}
public static void reverse(int[] arr){
int length = arr.length -1;
for (int start = 0,end = length;start<=end;start++,end--){
int tmp = arr[start];
arr[start] = arr[end];
arr[end] = tmp;
}
}
public static void printArrarry(int[] arr){
System.out.print("[");
for (int i=0;i<arr.length;i++){
if(i == arr.length-1){
System.out.print(arr[i]);
}else{
System.out.print(arr[i]+",");
}
}
System.out.print("]");
}
}