package com.demo;
import java.util.Arrays;
public class SwapDemo{
public static void main(String[] args){
int [] a = new int[]{“1”,“2”,“3”,“4”,“5”,“6”)
};
System.out.println(Arrays.toString(a));
swap(a);
System.out.println(Arrays.toString(a));
}
public static void swap(int a[]){
int len = a.length;
for(int i=0;i<len/2;i++){
int tmp = a[i];
a[i] = a[len-1-i];
a[len-1-i] = tmp;
}
}
}