If I have a byte, how would the method look to retrieve a bit at a certain position?
Here is what I have know, and I don't think it works.
public byte getBit(int position) {
return (byte) (ID >> (position - 1));
}
where ID
is the name of the byte I am retrieving information from.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…