code: public int writeSamples(short[] data, int numSamples)
  	{
  		int numBytes = numSamples<<1;
  		byte[] theData = new byte[numBytes];
  		for (int y = 0, yc=0; y<numBytes; y+=2)
  		{
  			theData[y] = (byte) (data[yc] & 0x00FF);
  			theData[y + 1] = (byte) ((data[yc++] >>> 8) & 0x00FF);
  		}
  		return write(theData, numBytes);
  	}
docs: Write 16-bit audio