How to convert a (short) sample in a soundfile to array of bytes
<p>In converting from short to a byte array I found the following solution on the web but could not quite understand the logic involved.</p>

<pre><code>//buffer is an array of bytes, bytes[]
buffer[position] = (byte)(sample &amp; 0xff);
buffer[position+1] = (byte)((sample &gt;&gt; 8) &amp; 0xff);
</code></pre>

<p>Can someone tell me why 0xff (256) is being anded to the sample which is a short? </p>
