public final class Ints
extends java.lang.Object
int values.| Modifier and Type | Method and Description |
|---|---|
static byte[] |
copyTo(int value,
byte[] bytes,
int offset)
Copy the byte value of
value into bytes
starting at offset. |
static int |
fromByteArray(byte[] bytes)
Exactly equivalent to
fromByteArray(bytes, 0). |
static int |
fromByteArray(byte[] bytes,
int offset)
Decode an integer from array
bytes at offset. |
static int |
fromBytes(byte b0,
byte b1,
byte b2,
byte b3)
Assemble an
int value from it's component bytes. |
static byte[] |
toByteArray(int value)
Create a byte array of length
Integer.BYTES, and
populate it with value in big-endian order. |
public static byte[] toByteArray(int value)
Integer.BYTES, and
populate it with value in big-endian order.value - The value to convertpublic static byte[] copyTo(int value,
byte[] bytes,
int offset)
value into bytes
starting at offset. A total of Integer.BYTES
will be written to bytes.value - The value to convertbytes - The array to write the value intooffset - The offset at which to write the valuebytespublic static int fromByteArray(byte[] bytes)
fromByteArray(bytes, 0).bytes - The byte array to decode to an integerfromByteArray(byte[], int)public static int fromByteArray(byte[] bytes,
int offset)
bytes at offset.
Bytes from array bytes[offset] up to and including
bytes[offset + Integer.BYTES - 1] will be read from
array bytes.bytes - The byte array to decode to an integeroffset - The offset within the array to start decodingpublic static int fromBytes(byte b0,
byte b1,
byte b2,
byte b3)
int value from it's component bytes.b0 - Most significant byteb1 - Next most significant byteb2 - Next least significant byteb3 - Least significant byteint value represented by the arguments.