title: How to clear a bit in a byte?
body: <p>I need to <strong>set</strong> and <strong>clear</strong> some bits in bytes of a byte array. </p>
  
  <p><strong>Set</strong> works good but <strong>clear</strong> doesn't compile (I guess because negation has int as result and it's negative by then and ...).</p>
  
  <pre><code>public const byte BIT_1 = 0x01;
  public const byte BIT_2 = 0x02;
  
  byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
  
  // set 1st bit
  for (int i = 0; i &lt; bytes.Length; i++)
      bytes[i] |= BIT_1;
  
  // clear 2nd bit (set it to 0)
  for (int i = 0; i &lt; bytes.Length; i++)
      bytes[i] &amp;= (~BIT_2);
  </code></pre>
  
  <p>How can I <strong>clear</strong> bits in a byte in a <em>preferably</em> simple way ?</p>