int max = 200000000;//2亿
BitSet bset = new BitSet(max);
Random random = new Random();
for(int i=0;i<max;i++){
bset.set(Math.abs(random.nextInt(max)));
}
System.out.println("加载完毕!");
long lo = System.currentTimeMillis();
int[] top100 = new int[100];
int location = 0;
for(int i=max;i>=0;i--){
boolean bool = bset.get(i);
if(location==100){
break;
}
if(bool){
top100[location] = i;
location++;
}
}
System.out.println("花费:"+(System.currentTimeMillis()-lo));
for(int i=0;i<100;i++){
System.out.println(top100[i]);
}
花费是0毫秒