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 =
Wouldn't doing it this way be much more unlikely for mistakes?
int[] intArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int[] temp = new int[intArray.length]; for(int i = intArray.length - 1; i > -1; i --){ temp[intArray.length - i -1] = intArray[i]; } intArray = temp;