title: Why do these bitwise operations result in the uppercase letter?
body: <p>I have the following code:</p>
  
  <pre><code>static char toUpper(char c)
  {
      if (c &gt;= 'a' &amp;&amp; c &lt;= 'z')
          return (char) (c &amp; ~('a' - 'A'));
  
      return c;
  }
  </code></pre>
  
  <p>Why does this work to correctly come up with the uppercase letter? The bitwise operations are what I am mostly interested in. I understand the math more or less and I understand that it <em>does work</em> but not the underlying reason as to <em>why</em> it works.</p>