public class Bytes extends Object
Modifier and Type | Method and Description |
---|---|
static float |
convertFixedPointToFloat(byte[] data,
int offset)
Convert 2 bytes in fixed point format to
float . |
static byte[] |
copyOfRange(byte[] source,
int from,
int to)
Copy a range of a given byte array.
|
static int |
parseBE2BytesAsInt(byte[] data,
int offset)
Parse 2 bytes in big endian byte order as an
int . |
static int |
parseBE4BytesAsInt(byte[] data,
int offset)
Parse 4 bytes in big endian byte order as an
int . |
static long |
parseBE4BytesAsUnsigned(byte[] data,
int offset)
Parse 4 bytes in big endian byte order as an unsigned integer.
|
static String |
toHexString(byte[] data,
boolean upper)
Convert a byte array to a hex string.
|
public static int parseBE2BytesAsInt(byte[] data, int offset)
int
.public static int parseBE4BytesAsInt(byte[] data, int offset)
int
.public static long parseBE4BytesAsUnsigned(byte[] data, int offset)
public static float convertFixedPointToFloat(byte[] data, int offset)
float
.public static String toHexString(byte[] data, boolean upper)
data
- An input byte array.upper
- true
to generate a upper-case hex string.
false
to generate a lower-case hex string.data
is null
,
null
is returned.public static byte[] copyOfRange(byte[] source, int from, int to)
source
- A source byte array.from
- The start index of the range in the source byte array (inclusive).to
- The end index of the range in the source byte array (exclusive).null
is returned if (1) source
is null
, (2) from
is negative, (3) to
is
negative, (4) the copy length (to - from
) is negative, or
(5) from +
the copy length exceeds source.length
.Copyright © 2016. All rights reserved.