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 =
public static void main(String args[]) { int [] arr = {10, 20, 30, 40, 50}; reverse(arr, arr.length); } private static void reverse(int[] arr, int length) { for(int i=length;i>0;i--) { System.out.println(arr[i-1]); } }