maoaolianxi

package dududu;

public class maopao {

    public static void main(String[] args) {
        // TODO 自动生成的方法存根

        
        int[] array = {49,38,65,97,76,13,27,19};
        
        for (int i = 0; i <array.length;i++){
            
            System.out.print(array[i] + "\t");
        }
        
        System.out.println();
        
        for (int j = 1; j < array.length-1;j++)
        
        for (int i = 0; i < array.length-j;i++)
        {
            
            if(array[i] >array[i + 1]){
                
                int t = array[i];
                
                array[i] = array[i + 1];
                
                array[i + 1] = t;
            }
        }
        
        for (int i = 0; i<array.length;i++){
            
            System.out.print(array[i] + "\t");
        }
        System.out.println();
    }

}

 

posted @ 2015-12-07 08:32  刘某人丶  阅读(168)  评论(0编辑  收藏  举报