short to byte and byte to short conversion in Android
<p>I am developing a software in Android.  In a particular portion of software, I need to convert short to byte and re-convert to it to short. I tried below code but values are not same after conversion.</p>

<pre><code>  short n, n1;
  byte b1, b2;
  n = 1200;
  // short to bytes conversion
  b1 = (byte)(n &amp; 0x00ff);
  b2 = (byte)((n &gt;&gt; 8) &amp; 0x00ff);

  // bytes to short conversion
  short n1 = (short)((short)(b1) | (short)(b2 &lt;&lt; 8));
</code></pre>

<p>after executing the code values of n and n1 are not same. Why?</p>
