protected boolean[] bitArray = new boolean[8];
protected void readNextByte() throws IOException {
latestReadByte = reader.read();
int decimtalTal = latestReadByte
for(int n= 0; n < 8; n++){
int pos = (int)Math.pow(2, n);
bitArray[7-n] = (decimalTal & pos) == pos; // THIS LINE
// what is the bitwise And in bracket == pos supposed to mean?
}
}
最佳答案
bitArray[7-n] =
赋值右侧的代码正在测试是否设置了decimalTal 的位n
。如果该位已设置(非零),则计算结果为 true;如果该位清除(零),则计算结果为 false。
关于java - 最后一段代码到底在做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15193257/