@Test public void testSortObject() { System.out.println("sort object"); Integer[] data1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int[] order1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; assertTrue(Arrays.equals(order1, QuickSort.sort(data1))); Integer[] data2 = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; int[] order2 = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; assertTrue(Arrays.equals(order2, QuickSort.sort(data2))); Integer[] data3 = {0, 1, 2, 3, 5, 4, 6, 7, 8, 9}; int[] order3 = {0, 1, 2, 3, 5, 4, 6, 7, 8, 9}; assertTrue(Arrays.equals(order3, QuickSort.sort(data3))); Integer[] data4 = {4, 1, 2, 3, 0, 5, 6, 7, 8, 9}; int[] order4 = {4, 1, 2, 3, 0, 5, 6, 7, 8, 9}; assertTrue(Arrays.equals(order4, QuickSort.sort(data4))); }
public static int[] sort(int[] arr) { int[] order = new int[arr.length]; for (int i = 0; i < order.length; i++) { order[i] = i; } sort(arr, order); return order; }
QuickSort { public static int[] sort(int[] arr) { int[] order = new int[arr.length]; for (int i = 0; i < order.length; i++) { order[i] = i; } sort(arr, order); return order; } }
QuickSort { public static int[] sort(int[] arr) { int[] order = new int[arr.length]; for (int i = 0; i < order.length; i++) { order[i] = i; } sort(arr, order); return order; } private  QuickSort(); }
QuickSort { public static int[] sort(int[] arr) { int[] order = new int[arr.length]; for (int i = 0; i < order.length; i++) { order[i] = i; } sort(arr, order); return order; } private  QuickSort(); static int[] sort(int[] arr); static void sort(int[] arr, int[] brr); static void sort(int[] arr, int[] brr, int n); static void sort(int[] arr, double[] brr); static void sort(int[] arr, double[] brr, int n); static void sort(int[] arr, Object[] brr); static void sort(int[] arr, Object[] brr, int n); static int[] sort(float[] arr); static void sort(float[] arr, int[] brr); static void sort(float[] arr, int[] brr, int n); static void sort(float[] arr, float[] brr); static void sort(float[] arr, float[] brr, int n); static void sort(float[] arr, Object[] brr); static void sort(float[] arr, Object[] brr, int n); static int[] sort(double[] arr); static void sort(double[] arr, int[] brr); static void sort(double[] arr, int[] brr, int n); static void sort(double[] arr, double[] brr); static void sort(double[] arr, double[] brr, int n); static void sort(double[] arr, Object[] brr); static void sort(double[] arr, Object[] brr, int n); static int[] sort(T[] arr); static void sort(T[] arr, int[] brr); static void sort(T[] arr, int[] brr, int n); static void sort(T[] arr, int[] brr, int n, Comparator<T> comparator); static void sort(T[] arr, Object[] brr); static void sort(T[] arr, Object[] brr, int n); }
QuickSort { public static int[] sort(int[] arr) { int[] order = new int[arr.length]; for (int i = 0; i < order.length; i++) { order[i] = i; } sort(arr, order); return order; } private  QuickSort(); static int[] sort(int[] arr); static void sort(int[] arr, int[] brr); static void sort(int[] arr, int[] brr, int n); static void sort(int[] arr, double[] brr); static void sort(int[] arr, double[] brr, int n); static void sort(int[] arr, Object[] brr); static void sort(int[] arr, Object[] brr, int n); static int[] sort(float[] arr); static void sort(float[] arr, int[] brr); static void sort(float[] arr, int[] brr, int n); static void sort(float[] arr, float[] brr); static void sort(float[] arr, float[] brr, int n); static void sort(float[] arr, Object[] brr); static void sort(float[] arr, Object[] brr, int n); static int[] sort(double[] arr); static void sort(double[] arr, int[] brr); static void sort(double[] arr, int[] brr, int n); static void sort(double[] arr, double[] brr); static void sort(double[] arr, double[] brr, int n); static void sort(double[] arr, Object[] brr); static void sort(double[] arr, Object[] brr, int n); static int[] sort(T[] arr); static void sort(T[] arr, int[] brr); static void sort(T[] arr, int[] brr, int n); static void sort(T[] arr, int[] brr, int n, Comparator<T> comparator); static void sort(T[] arr, Object[] brr); static void sort(T[] arr, Object[] brr, int n);  }