Here you can find the source of longToBytes(long l)
public static byte[] longToBytes(long l)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] longToBytes(long l) { byte[] b = new byte[8]; b[0] = (byte) (l >>> 56); b[1] = (byte) (l >>> 48); b[2] = (byte) (l >>> 40); b[3] = (byte) (l >>> 32); b[4] = (byte) (l >>> 24); b[5] = (byte) (l >>> 16); b[6] = (byte) (l >>> 8); b[7] = (byte) (l); return b; }//from ww w . j a v a 2s . co m }