public final class ArrayHelper
extends java.lang.Object
Constructor and Description |
---|
ArrayHelper() |
Modifier and Type | Method and Description |
---|---|
static int |
swap32bitFromArray(byte[] value,
int offset)
Reads a signed 32 bit integer from an array coming from a device.
|
static void |
swap32bitsToArray(int value,
byte[] dest,
int offset)
Swaps an unsigned value around, and puts the result in an array that can be sent to a device.
|
static long |
swap64bitFromArray(byte[] value,
int offset)
Reads a signed 64 bit integer from an array coming from a device.
|
static int |
swapU16bitFromArray(byte[] value,
int offset)
Reads an unsigned 16 bit integer from an array coming from a device,
and returns it as an 'int'
|
public static void swap32bitsToArray(int value, byte[] dest, int offset)
value
- The value to swap.dest
- the destination arrayoffset
- the offset in the array where to put the swapped value.
Array length must be at least offset + 4public static int swap32bitFromArray(byte[] value, int offset)
value
- the array containing the intoffset
- the offset in the array at which the int startspublic static int swapU16bitFromArray(byte[] value, int offset)
value
- the array containing the 16 bit int (2 byte).offset
- the offset in the array at which the int starts
Array length must be at least offset + 2public static long swap64bitFromArray(byte[] value, int offset)
value
- the array containing the intoffset
- the offset in the array at which the int starts
Array length must be at least offset + 8