Boolean on Hexadecimal

840 Views Asked by At

I need help with ANDing two hex values but my approach is not working.

Question - Evaluate the following Expression 0x77 && 0x12

My Attempt I was told that you can divide up each hex digit into 4 blocks. This worked for bigger values such as 77 but as you can see the method doesn't work for 12. Is this the right approach?

7 = 0111    7= 0111     77=01110111

1 = 0001    2=0010      12=00010010  

0x77 && 0x12

  01110111
& 00010010  

  00010010