Here you can find the source of longToByteArray(long l)
public static byte[] longToByteArray(long l)
//package com.java2s; //License from project: LGPL public class Main { public static byte[] longToByteArray(long l) { byte[] ba = new byte[8]; for (int i = 0; i < 64; i += 8) { ba[i >> 3] = new Long((l & (255L << i)) >> i).byteValue(); }//ww w . ja va 2 s . c o m return ba; } }