int[] arr=new int[]{2,4,89,1,3,15,-23}; for(int i=0;i<arr.length/2;i++){ int temp=arr[i]; arr[i]=arr[arr.length-1-i]; arr[arr.length-1-i]=temp; }
for(int i=0,j=arr.length-1;i<j;i++,j--){ int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; }