java选择排序

 1 /**
 2          * 选择排序
 3          * @param a
 4          * @date 2016-10-8
 5          * @author shaobn
 6          */
 7         public static void selectSort(int[] a){
 8             for(int i = 0;i<a.length-1;i++){
 9                 int temp = 0;
10                 for(int j = i+1;j<a.length;j++){
11                     if(a[i]>a[j]){
12                         temp = a[i];
13                         a[i] = a[j];
14                         a[j] = temp ;
15                     }    
16                 }                    
17             }
18         for(int num:a){
19             System.out.println(num);
20         }    
21             
22         }
原文地址:https://www.cnblogs.com/assassin666/p/5937420.html