Reverse an array in Java
问题 I am trying to reverse an array in 2 ways: 1) By creating a new array which was very easy: public static int[] reverse(int[] array) { int[] reverseArray = new int[array.length]; for(int i = 0; i < reverseArray.length; i++) { reverseArray[i] = array[array.length - i - 1]; } return reverseArray; } 2) The second method I got my answer but I actually don't understand it very well, it actually makes use of swapping, giving the value of the array to a temporary variable then changes it and returns