List of utility methods to do Convert via ByteBuffer
byte[] | longTo4ByteArray(long n) long To Byte Array byte[] bytes = Arrays.copyOfRange(ByteBuffer.allocate(8).putLong(n).array(), 4, 8); assert bytes.length == 4 : bytes.length; return bytes; |
byte[] | longToByteArray(long l) Transform a long into a byte array ByteBuffer buffer = ByteBuffer.allocate(8);
buffer.putLong(l);
return buffer.array();
|
byte[] | longToByteArray(long value) long To Byte Array return ByteBuffer.allocate(Long.SIZE / Byte.SIZE).putLong(value).array();
|
byte[] | longToByteArray(long value) long To Byte Array byte[] byteArray = new byte[8]; ByteBuffer byteBuffer = ByteBuffer.wrap(byteArray); LongBuffer longBuffer = byteBuffer.asLongBuffer(); longBuffer.put(0, value); return byteArray; |
byte[] | longToByteArray(long[] array) long To Byte Array byte[] result = new byte[array.length * 8]; ByteBuffer buffer = ByteBuffer.wrap(result); for (int i = 0; i < array.length; i++) { buffer.putLong(array[i]); return result; |
byte[] | longToBytes(final long value) long To Bytes return ByteBuffer.allocate(BYTES_IN_LONG).putLong(value).array();
|
byte[] | longToBytes(long aLong) Convert a long to 8 bytes. return ByteBuffer.allocate(8).putLong(aLong).array();
|
byte[] | longToBytes(long l) long To Bytes buffer.putLong(0, l);
return buffer.array();
|
byte[] | longToBytes(long l, int size) long To Bytes ByteBuffer buf = ByteBuffer.allocate(size); for (int i = 0; i < size; i++) buf.put(getNthByteFromLong(l, size - i - 1)); return buf.array(); |
byte[] | longToBytes(long x) long To Bytes byte[] payload = ByteBuffer.allocate(8).putLong(x).array(); return payload; |