title: java - Binary AND (&) operation for image.getRGB(x,y);
body: <p>Look the code below:</p>
  
  <pre><code>image.getRGB(x,y) &amp; 0x000000FF
  </code></pre>
  
  <p>When the result image.getRGB(x,y) is <strong>-16777216</strong>, the AND operation result is 0 (BLACK COLOR)</p>
  
  <p>When the result image.getRGB(x,y) is <strong>-1</strong>, the AND operation result is 255 (WHITE COLOR)</p>
  
  <p>My question is, if you look to my related article in <a href="https://stackoverflow.com/questions/36240069/java-understanding-about-image-getrgbx-y-output-in-binary-term">Java - Understanding about image.getRGB(x,y) output in Binary term</a> you can see the result of image.getRGB(x,y) in binary term include Alpha, Red, Green, and Blue (32 bit) but 0x000000FF is only 8-bit; for example:</p>
  
  <pre><code>image.getRGB : 1111 1111 0000 0000 0000 0000 0000 0000
  0x000000FF : 1111 1111
  image.getRGB &amp; 0x000000FF : 0000 0000
  </code></pre>
  
  <p>Second Example :</p>
  
  <pre><code>image.getRGB : 1111 1111 1111 1111 1111 1111 1111 1111
  0x000000FF : 1111 1111
  image.getRGB &amp; 0x000000FF : 1111 1111
  </code></pre>
  
  <p>How they compare between 8 bit of 0x00000FF with 32 bit image.getRGB so that they get result 0 or 255 like my case above?</p>