zoukankan      html  css  js  c++  java
  • test

    package com.vfsd.core;
    
    public class Test1 {
        public static int[] a1= {3,8,2,5,1,9};
        public static void main(String[] args) {
            
            
            print1();
            
            for(int k=0;k<a1.length-1;k++)
            {
                for(int k2=k+1;k2<a1.length;k2++)
                {
                    int index1=a1[k];
                    int index2=a1[k2];
                    if(index1>index2)
                    {
                        a1[k]=index2;
                        a1[k2]=index1;
                        
                        
                        //continue;
                        //break;
                    }
                    
                    print1();
                }
                //print1();
            }
            
            print1();
        }
        
        public static void print1(){
            System.out.println("==================================== ");
            System.out.print(" [");
            for(int k=0;k<a1.length;k++)
            {
                System.out.print(a1[k]+" ");
            }
            System.out.print("]
    ");
            System.out.println("==================================== ");
        }
    
    }
    ==================================== 
     [3 8 2 5 1 9 ]
    ==================================== 
    ==================================== 
     [3 8 2 5 1 9 ]
    ==================================== 
    ==================================== 
     [2 8 3 5 1 9 ]
    ==================================== 
    ==================================== 
     [2 8 3 5 1 9 ]
    ==================================== 
    ==================================== 
     [1 8 3 5 2 9 ]
    ==================================== 
    ==================================== 
     [1 8 3 5 2 9 ]
    ==================================== 
    ==================================== 
     [1 3 8 5 2 9 ]
    ==================================== 
    ==================================== 
     [1 3 8 5 2 9 ]
    ==================================== 
    ==================================== 
     [1 2 8 5 3 9 ]
    ==================================== 
    ==================================== 
     [1 2 8 5 3 9 ]
    ==================================== 
    ==================================== 
     [1 2 5 8 3 9 ]
    ==================================== 
    ==================================== 
     [1 2 3 8 5 9 ]
    ==================================== 
    ==================================== 
     [1 2 3 8 5 9 ]
    ==================================== 
    ==================================== 
     [1 2 3 5 8 9 ]
    ==================================== 
    ==================================== 
     [1 2 3 5 8 9 ]
    ==================================== 
    ==================================== 
     [1 2 3 5 8 9 ]
    ==================================== 
    ==================================== 
     [1 2 3 5 8 9 ]
    ==================================== 
    QQ 3087438119
  • 相关阅读:
    棋盘格渲染
    openvino踩坑之Data type is unsupported
    [video super resolution] ESPCN论文笔记
    tensorflow fp16训练
    openvino安装踩坑记
    python numpy中astype使用不当导致图像出现artifact
    Python~字典
    Django~待解决的问题
    正则表达式应用
    GitLab使用
  • 原文地址:https://www.cnblogs.com/herd/p/14303199.html
Copyright © 2011-2022 走看看