Here you can find the source of long2ByteArray(long l)
public static byte[] long2ByteArray(long l)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] long2ByteArray(long l) { byte[] array = new byte[8]; int i, shift; for (i = 0, shift = 56; i < 8; i++, shift -= 8) { array[i] = (byte) (0xFF & (l >> shift)); }//from w w w . j a v a 2 s . co m return array; } }