I'm trying to set bits in Java byte variable. It does provide propper methods like .setBit(i)
. Does anybody know how I can realize this?
I can iterate bit-wise through a given byte:
if( (my_byte & (1 << i)) == 0 ){
}
However I cannot set this position to 1 or 0, can I?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…