Here you can find the source of long2byte(long l)
public static final byte[] long2byte(long l)
//package com.java2s; public class Main { public static final byte[] long2byte(long l) { byte dest[] = new byte[8]; dest[7] = (byte) (int) (l & 255L); dest[6] = (byte) (int) (l >>> 8 & 255L); dest[5] = (byte) (int) (l >>> 16 & 255L); dest[4] = (byte) (int) (l >>> 24 & 255L); dest[3] = (byte) (int) (l >>> 32 & 255L); dest[2] = (byte) (int) (l >>> 40 & 255L); dest[1] = (byte) (int) (l >>> 48 & 255L); dest[0] = (byte) (int) (l >>> 56 & 255L); return dest; }/*from w w w.ja v a 2 s .co m*/ }