I want to know if there's a way I can access a specific bit in a byte. Example, a byte looks like this: 00001001. What if I want to access 00001001, end test whether it's true or false.
I've tried using bit-shifting to the left, with the value of the bit's spot from the end-1, in this case: << 3, which results in 01001000. and then shifting >> 7, which results in that the specific bit is the only one left.
This doesn't work though, because the bits shifted away come back. The only explanation I can find to this is that they are passed over to the next byte. I tried this with int though, which is only one byte long, right?
Anyway, can I make this method work, or do it in an easier way?