Converting a byte[] to short[] in Java
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5625573/byte-array-to-short-array-and-back-again-in-java">byte array to short array and back again in java</a>  </p>
</blockquote>



<p>the <code>encodeAudio()</code> method in Xuggler has the following parameters:<br>
<li> int streamIndes </li>
<li> short[] samples </li>
<li> long timeStamp </li>
<li> TimeUnit unit </li><br>
Using <code>TargetDataLine</code> from <code>javax.sound.sampled</code> I can read the data into a <code>byte[]</code> array   </p>

<pre><code>byte[] tempBuffer = new byte[10000];
fromMic.read(tempBuffer,0,tempBuffer.length);
</code></pre>

<p>But the problem is that the <code>samples</code> argument needs <code>short[]</code>  </p>
