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 =
This will help you
int a[] = {1,2,3,4,5}; for (int k = 0; k < a.length/2; k++) { int temp = a[k]; a[k] = a[a.length-(1+k)]; a[a.length-(1+k)] = temp; }