Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static long toLong(byte[] value) {
- ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
- final byte val = (byte) (value[0] < 0 ? 0xFF : 0);
- for(int i = value.length; i < Long.BYTES; i++)
- buffer.put(val);
- buffer.put(value);
- return buffer.getLong(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement