If I have the decimal 12
, its representation in binary is 00001100
. How do I extract the fifth bit, which in this case is 1
? I tried shifting left by 4
and AND
-ing with 1
but this is not correct. Can someone tell me what I am doing wrong?
player = low << 4 & 1;