I have a byte array where the data in the array is actually short data. The bytes are ordered in little endian:
3, 1, -48, 0, -15, 0, 36, 1
Which when converted to short values results in:
259, 208, 241, 292
Is there a simple way in Java to convert the byte values to their corresponding short values? I can write a loop that just takes every high byte and shift it by 8 bits and OR it with its low byte, but that has a performance hit.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…