Here you can find the source of longToByteArr(long v)
public static byte[] longToByteArr(long v)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] longToByteArr(long v) { return new byte[] { (byte) (v >>> 56), (byte) (v >>> 48), (byte) (v >>> 40), (byte) (v >>> 32), (byte) (v >>> 24), (byte) (v >>> 16), (byte) (v >>> 8), (byte) (v) }; }/*from w w w. ja v a 2 s.c om*/ public static byte[] longToByteArr(long v, byte[] arr, int position) { for (int i = 56; i >= 0; i -= 8) { arr[position--] = (byte) (v >>> i); } return arr; } }