public static void main(String[] args) throws UnknownHostException {
int[] arr = {11,22,322,43,54,65,37,82,93,130};
printArr(arr);
for(int i=0, j=arr.length-1; i<=j; i++, j--){
int temp =arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
printArr(arr);
}
public static void printArr(int[] arr){
for(int i=0; i<arr.length; i++){
System.out.print(arr[i]+" ");
}
System.out.println();
} |