Here you can find the source of fromLong(long value, byte[] arr, int offset)
public static void fromLong(long value, byte[] arr, int offset)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] fromLong(long value) { byte[] arr = new byte[8]; fromLong(value, arr, 0);/* w w w .ja v a 2 s . c om*/ return arr; } public static void fromLong(long value, byte[] arr, int offset) { value ^= 1L << 63;//toggling highest bit arr[offset] = (byte) (value >>> 56); arr[offset + 1] = (byte) (value >>> 48); arr[offset + 2] = (byte) (value >>> 40); arr[offset + 3] = (byte) (value >>> 32); arr[offset + 4] = (byte) (value >>> 24); arr[offset + 5] = (byte) (value >>> 16); arr[offset + 6] = (byte) (value >>> 8); arr[offset + 7] = (byte) value; } }