// allocate storage
dataBuffer = new short[(bufferWidth + spacer) * bufferHeight];
// read data
for (int i = 0; i < bufferWidth * bufferHeight; i++)
dataBuffer[i] = binFile.readShort();
// done
binFile.close();
// This is important for image creation.