package pubs; class ArrayReverse { static int[] arrayReverse(int[] A){ int l = A.length; int[] R = new int[l]; for (int i=l;i> 0;i--){ R[l-i]=A[i-1]; } return R; } public static void main(String[] args) { int[] test; int[] result; // Prepare the test with 10 elements test = new int[10]; for (int i = 0; i < 10; i++) { test[i] = i; } // Start first test result = arrayReverse(test); /*System.out.println("Result: "); for (int i = 0; i < result.length; i++) System.out.println(result[i]+" "); // Prepare the test with 50 elements test = new int[50]; for (int i = 0; i < 50; i++) { test[i] = i; } // Start second test result = arrayReverse(test); System.out.println("Result: "); for (int i = 0; i < result.length; i++) System.out.println(result[i]+" "); // Prepare the test with 100 elements test = new int[100]; for (int i = 0; i < 100; i++) { test[i] = i; } // Start the third test result = arrayReverse(test); System.out.println("Result: "); for (int i = 0; i < result.length; i++) System.out.println(result[i]+" "); */ } }