This method is pretty much copied from a java program, but I have worries it doesn't work as intended in c# if ID is a byte, what does this do?
public int getBit(int position)
{
return (ID >> (position - 1)) & 1;
}
This method is pretty much copied from a java program, but I have worries it doesn't work as intended in c# if ID is a byte, what does this do?
public int getBit(int position)
{
return (ID >> (position - 1)) & 1;
}
Extract from the ID the bit at the position passed.
Position should be 1-8
Returns the bit value (0-1)
For example:
ID = 128; // 10000000
getBit(8); // returns 1
ID = 127; // 01111111
getBit(8); // returns 0