I use a byte to store some flag like 10101010, and I would like to know how to verify that a specific bit is at 1 or 0.
10101010
1
0
Nobody's been wrong so far, but to give a method to check an arbitrary bit:
int checkBit( byte in, int bit ) { return in & ( 1 << bit ); }
If the function returns non-zero, the bit is set.