1 代码 2 public class SelectSort { 3 public static void main(String[] args){ 4 int[] sort={8,5,7,9,55}; 5 Sort(sort); 6 for(int i=0;i<sort.length;i++) 7 System.out.print(sort[i]+" "); 8 9 } 10 11 public static void Sort(int[] sort){ 12 for(int i=0;i<sort.length-1;i++){ 13 for(int j=i+1;j<sort.length;j++){ 14 if(sort[i]>sort[j]){ 15 int temp; 16 temp=sort[i]; 17 sort[i]=sort[j]; 18 sort[j]=temp; 19 } 20 } 21 } 22 } 23 }