Sort { public static void selectSort(int[] data) { int len = data.length; for (int i = 0; i < len; i++) { int index = i; int maxValue = data[index]; for (int j = index; j < len; j++) { if (data[j] > maxValue) { index = j; maxValue = data[j]; } } int temp = data[i]; data[i] = data[index]; data[index] = temp; } }  static void maopaoSort(int[] data); static void quickSort(int[] data); static void insertSort(int[] data); static void selectSort(int[] data); static void quickSort(int[] data, int left, int right); static void quickSort2(int[] arr, int l, int r); static void heapSort(int[] arr, int node); static void buildHeap(int[] arr, int length); static void adjustHeap(int[] arr, int index, int length); static void swap(int[] arr, int a_index, int b_index);  }
@Test public void testSelectSort() { int[] data = {1, 4, 5, 3, 2}; Sort.selectSort(data); for (int i : data) { System.out.println(i); } }