踌躇不定的态度

博客园 首页 新随笔 联系 订阅 管理
 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 }

 

posted on 2013-09-27 18:04  踌躇不定的态度  阅读(117)  评论(0编辑  收藏  举报