Java byte数组转换无符号short类型示例如下:
public static short binaryArrayToShort(byte[] binaryArray) {
int b0 = binaryArray[0] & 0xFF;
int b1 = binaryArray[1] & 0xFF;
return (short) ((b1 << 8) | b0);
}
注意:本文归作者所有,未经作者允许,不得转载