title: C++ bit shifting
body: <p>I am new to working with bits &amp; bytes in C++ and I'm looking at some previously developed code and I need some help in understanding what is going on with the code.  There is a byte array and populating it with some data and I noticed that the data was being '&amp;' with a 0x0F (Please see code snipped below).  I don't really understand what is going on there....if somebody could please explain that, it would be greatly apperciated.  Thanks!</p>
  
  <pre><code>//Message Definition
  /*
  Byte 1: Bit(s) 3:0 = Unused; set to zero
  Bit(s) 7:4 = Message ID; set to 10
  */
  
  /*
  Byte 2: Bit(s) 3:0 = Unused; set to zero
  Bit(s) 7:4 = Acknowledge Message ID; set to 11
  */    
  
      //Implementation
  
      BYTE Msg_Arry[2];
      int Msg_Id = 10;
      int AckMsg_Id = 11;
  
  
      Msg_Arry[0] = Msg_Id  &amp; 0x0F;       //MsgID &amp; Unused
      Msg_Arry[1] = AckMsg_Id &amp; 0x0F;     //AckMsgID &amp; Unused
  </code></pre>