【发布时间】:2014-04-05 22:31:29
【问题描述】:
我正在寻找一种将随机位集存储到数组中的方法。下面的代码不完整,但我只想帮助理解如何随机化一组位。
public static boolean[] makeRandomBits(int size) {
BitSet[] bitArray = new BitSet[size];
for(int i=0; i<size; i++){
bitArray[i].set(/*Right here is where my confusion is*/);
}
/*other stuff below*/
}
我正在寻找类似于以下内容的输出:01101001
【问题讨论】:
标签: java arrays random boolean bits