I am trying to reverse an int array in Java.
This method does not reverse the array.
for(int i = 0; i < validData.length; i++) { int temp =
There are some great answers above, but this is how I did it:
public static int[] test(int[] arr) { int[] output = arr.clone(); for (int i = arr.length - 1; i > -1; i--) { output[i] = arr[arr.length - i - 1]; } return output; }