SelectSort { public static void sort(Comparable[] a) { int N = a.length; for (int i = 0; i < N; i++) { int min = i; for (int j = i + 1; j < N; j++) { if (Utils.less(a[j], a[min])) min = j; } Utils.exch(a, i, min); assert Utils.isSorted(a, 0, i); } assert Utils.isSorted(a); } private  SelectSort(); static void mysort(Comparable[] a); static void sort(Comparable[] a); static void sort(Object[] a, Comparator c);  }
@Test public void sort() { Integer[] sortIntegerArray = {7,6,5,4,3}; Integer[] resultArray = {3,4,5,6,7}; SelectSort.sort(sortIntegerArray); Assert.assertArrayEquals(sortIntegerArray, resultArray); }