public static void reverseArray(int[] A, int i, int j) { if(i < j) { int temp = A[i]; // storing values of i A[i] = A[j]; A[j] = temp; reverseArray(A, i+1, j-1); } } public static void reverseArray2(int[] data, int low, int high) { low = 0; high = data.length-1; while(low <= high) { int temp = data[low]; data[low++] = data[high]; data[high--] = temp; } }