首页 > 代码库 > 乱序、排序

乱序、排序

public static void shiTi()
    {
        Integer [] num1 = new Integer[200];
        Integer [] num2 = new Integer[200];
        int k;
        Set<Integer> a =new HashSet<Integer>();
        Set<Integer> b =new TreeSet<Integer>();
        Random random = new Random();
        while(a.size()<200){
            k = random.nextInt(200)+1;
            a.add(k);
            b.add(k);
            if(num1[a.size()-1] == null)
            {num1[a.size()-1] = k;
            }
        }
        num2 = b.toArray(num2);
        for(int i =0; i < 200; i++)
        {
            System.out.println(num1[i]+"_"+num2[i]);
        }
    }

 

乱序、排序