title: Java bit operation to remove (zero out) un-interested bits
body: <p>Example </p>
  
  <pre><code>byte b = 127;
  </code></pre>
  
  <p>(initialize be to equal 11111111)</p>
  
  <p>Now I only care about bits 1 and 0</p>
  
  <p>how do i bit shift do get 00000011</p>
  
  <p>I think this is called "masking bits" if I'm right?</p>
  
  <p>I tried 
  b &lt;&lt; 5 
  then 
  b>> 5 
  to zero out the other bits but that's just wrong</p>
  
  <p>My goal</p>
  
  <pre><code>switch ((myByte &gt;&gt; 3) &amp; 3)
  {
      case 3:
          resevered = true;
          break;
      case 2:
          open = true;
          break;
      case 1:
          SingleOnly = true;
          break;
      case 0:
          daulMode = true;
          break;
  }
  </code></pre>