码迷,mamicode.com
首页 > 编程语言 > 详细

数组的排列-从起始排列

时间:2016-07-10 12:23:06      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

public class ShengXu {
    public static void main(String []args){
        int e[]=new int[]{2,1,4,9,3};//实例化数组
        for(int i=0;i<e.length-1;i++){
            for(int j=0;j<e.length-i-1;j++){
                int num=0;
                if(e[j]>e[j+1]){
                    num=e[j];
                    e[j]=e[j+1];
                    e[j+1]=num;
                }
            }
        }
        for(int s:e){
            System.out.print(s+"  ");
        }
    }
}

1  2  3  4  9 

数组的排列-从起始排列

标签:

原文地址:http://www.cnblogs.com/tianwei0/p/5657283.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!