https://www.cnblogs.com/wikiki/p/5340925.html
https://www.cnblogs.com/wikiki/p/5340920.html
// byte数组转short数组
public static short[] byteArray2ShortArray(byte[] data) {
short[] retVal = new short[data.length/2];
for (int i = 0; i < retVal.length; i++)
retVal[i] = (short) ((data[i * 2] & 0xff) | (data[i * 2 + 1] & 0xff) << 8);
return retVal;
}
// short数组转byte数组
public static byte[] ShortArray2byteArray(short[] s) {
byte[] targets = new byte[s.length*2];
for (int i=0;i>> offsets[0]) & 0xff);
targets[i*2+1] = (byte) ((s[i] >>> offsets[1]) & 0xff);
}
return targets;
}
public static short bytesToShort(byte[] bytes) {
return ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).getShort();
}



