title: What does value & 0xff do in Java?
body: <p>I have the following Java code:</p>
  
  <pre><code>byte value = 0xfe; // corresponds to -2 (signed) and 254 (unsigned)
  int result = value &amp; 0xff;
  </code></pre>
  
  <p>The result is 254 when printed, but I have no idea how this code works. If the <code>&amp;</code> operator is simply bitwise, then why does it not result in a byte and instead an integer?</p>