byteArray = new byte[10000];
-- some code here ----
byteBuffer.wrap(byteArray);
for (int i=0; byteBuffer.hasRemaining(); i++)
{
shortArray[i] = byteBuffer.getShort();
System.out.println(shortArray[i]);
}
The byteBuffer.hasRemaining()
gets flagged with a NullPointerException
although I have provided it with a backing array.