Class Longs
java.lang.Object
one.tomorrow.transactionaloutbox.commons.Longs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]toByteArray(long data) Returns a big-endian representation of value in an 8-element byte array; equivalent toByteBuffer.allocate(8).putLong(value).array().
For example, the input value0x1213141516171819Lwould yield the byte array{0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}.static longtoLong(byte[] data) Returns the long value whose big-endian representation is stored in the given byte array (length must be 8); equivalent toByteBuffer.wrap(bytes).getLong().
For example, the input byte array{0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}would yield the long value0x1213141516171819L.
-
Constructor Details
-
Longs
public Longs()
-
-
Method Details
-
toByteArray
public static byte[] toByteArray(long data) Returns a big-endian representation of value in an 8-element byte array; equivalent toByteBuffer.allocate(8).putLong(value).array().
For example, the input value0x1213141516171819Lwould yield the byte array{0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}. -
toLong
public static long toLong(byte[] data) Returns the long value whose big-endian representation is stored in the given byte array (length must be 8); equivalent toByteBuffer.wrap(bytes).getLong().
For example, the input byte array{0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}would yield the long value0x1213141516171819L.- Parameters:
data- array of 8 bytes, the big-endian representation of the long- Returns:
- the long value
- Throws:
IllegalArgumentException- ifdataisnullor has length != 8.
-