{ public static void main(String args[]) { int[] array = StdIn.readAllInts(); for (int i = 0; i<array.length;i++){ int temp = array[i]; array[i] = array[(array.length) - 1 - i]; array[(array.length) - 1 - i] = temp; System.out.print(array[i] + " "); } } }
What am I doing wrong? My input is {1, 2, 3, 1, 2, 3} and outcome of it is {3, 2, 1, 1, 2, 3}.. How to make to return {3, 2, 1, 3, 2, 1} ?