java吧 关注:1,236,833贴子:12,707,896
  • 1回复贴,共1

请高人指点

只看楼主收藏回复

我给程序加了一个子方法后,编译给出
Note: sortSeqL.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
程序运行结果是对的。但是怎样让程序不报上面的警告呢?
加的子方法如下,哪里有问题
public static int[] sortRand(int max, int nl){
int[] a = new int[nl];
ArrayList list = new ArrayList();
int n = max;
Random rand = new Random();
boolean[] bool = new boolean[n];
int num =0;
for (int i = 0; i<nl; i++){
do{
//如果产生的数相同继续循环
num = rand.nextInt(n);
}while(bool[num]);
bool[num] =true;
list.add(num);
}
//System.out.println (list);
for(int i = 0;i <list.size();i++) {
a[i] = (Integer)(list.get(i));
}
Arrays.sort(a);
return a;
}


1楼2014-01-16 20:25回复
    http://blog.csdn.net/kook_okko/article/details/2480295
    已解决


    2楼2014-01-16 20:41
    回复