public class Utils
extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static short[] |
byteToShortArray(byte[] byteArray,
int offset,
int length,
boolean little)
Converts a byte array into a short array.
|
static void |
shortArrToByteArr(short[] in,
byte[] res,
boolean little)
The result array must be twice as the input one.
|
static byte[] |
shortToBytes(short v,
boolean little)
Get a pair of bytes representing a short value.
|
public static short[] byteToShortArray(byte[] byteArray, int offset, int length, boolean little) throws java.lang.ArrayIndexOutOfBoundsException
(byteArray.length - 1)/2
, i.e., the last byte is
discarded.byteArray
- a byte arrayoffset
- which byte to start fromlength
- how many bytes to convertnull
if byteArray is of zero
lengthjava.lang.ArrayIndexOutOfBoundsException
public static void shortArrToByteArr(short[] in, byte[] res, boolean little)
public static byte[] shortToBytes(short v, boolean little)
v
- shortlittle
- boolean