Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { public static byte[] shortArr2byteArr(final short[] pcm, final int length) { byte[] dst = new byte[length * 2]; ByteBuffer buf = ByteBuffer.wrap(dst); buf.order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().put(pcm, 0, length); return dst; } }