public class ArrayTest9 { public static void main(String[] args){ //数组的排序 int[] arr = {23,3242,32422,1}; printArray(arr); selectSort(arr); printArray(arr); } public static void printArray(int[] arr) { for (int i = 0; i<arr.length; i++) { if(i!=arr.length-1) { System.out.print(arr[i]+","); }else{ System.out.println(arr[i]); } } } public static void selectSort(int[] arr) { for(int i=0; i < arr.length-1;i++) { for(int j = i+1;j<arr.length;j++) { if(arr[i] > arr[j]) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } } } }