I have a hex number 0x37 and its binary representation is 0011 0111. How do I access the first 2 bits of the binary representation which is \"11\"? How do I use bit shifting
Your best bet is to use bit masking, as you had mentioned. Something like this should do the trick:
x = 0x37; y = x&0x30; //Mask out the first two bits of the higher nibble y = y>>4;