Sort { @SuppressWarnings("WeakerAccess") public static void reverse(int[] order) { reverse(order, 0, order.length); }  @SuppressWarnings("WeakerAccess") static void sort(int[] order, double[] values); @SuppressWarnings("WeakerAccess") static void sort(int[] order, double[] values, int n); @SuppressWarnings("WeakerAccess") static void sort(int[] order, double[] values, int start, int n); @SuppressWarnings("WeakerAccess") static void sort(double[] key, double[] ... values); @SuppressWarnings("WeakerAccess") static void sort(double[] key, int start, int n, double[]... values); @SuppressWarnings("UnusedDeclaration") static void checkPartition(int[] order, double[] values, double pivotValue, int start, int low, int high, int end); @SuppressWarnings("WeakerAccess") static void reverse(int[] order); @SuppressWarnings("WeakerAccess") static void reverse(int[] order, int offset, int length); @SuppressWarnings({"WeakerAccess", "SameParameterValue"}) static void reverse(double[] order, int offset, int length);  }
@Test public void testReverse() { int[] x = new int[0]; Sort.reverse(x); x = new int[]{1, 2, 3, 4, 5}; Sort.reverse(x); for (int i = 0; i < 5; i++) { assertEquals(5 - i, x[i]); } Sort.reverse(x, 1, 3); assertEquals(5, x[0]); assertEquals(2, x[1]); assertEquals(3, x[2]); assertEquals(4, x[3]); assertEquals(1, x[4]); Sort.reverse(x, 3, 0); assertEquals(5, x[0]); assertEquals(2, x[1]); assertEquals(3, x[2]); assertEquals(4, x[3]); assertEquals(1, x[4]); x = new int[]{1, 2, 3, 4, 5, 6}; Sort.reverse(x); for (int i = 0; i < 6; i++) { assertEquals(6 - i, x[i]); } }