title: Behaviour of unsigned right shift applied to byte variable
body: <p>Consider the following snip of java code</p>
  
  <pre><code>byte b=(byte) 0xf1;
  byte c=(byte)(b&gt;&gt;4);
  byte d=(byte) (b&gt;&gt;&gt;4);
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>c=0xff
  d=0xff
  </code></pre>
  
  <p>expected output:</p>
  
  <pre><code>c=0x0f
  </code></pre>
  
  <p>how?
  as b in binary <code>1111 0001</code>
  after unsigned right shift <code>0000 1111</code> hence <code>0x0f</code> but why is it <code>0xff</code>  how?</p>