title: What does this java method do with bitwise operations?
body: <p>Im not familiar with bitwise operations. This is an image manipulation algorithm. What is happening?</p>
  
  <pre><code>void binarize50(int pixels[]) {
          for(int i = 0; i &lt; pixels.length; i++) {
              int gray = ((pixels[i] &amp; 0xff) + ((pixels[i] &amp; 0xff00) &gt;&gt; 8) + ((pixels[i] &amp; 0xff0000) &gt;&gt; 16)) / 3;
              pixels[i] = gray &lt; 128 ? 0xff000000 : 0xffffffff;
          }
  }
  </code></pre>
  
  <p>I found out that (pixels[i] &amp; 0xff) just "normalizes" somehow and let the pixel/byte become a positive value between 0..255. </p>
  
  <p>What does (pixels[i] &amp; 0xff00 >> 8) do?<br>
  What is 0xff00?
  And why if grey &lt; 128 the pixel becomes 0xff000000 or else 0xffffffff?</p>