Here you can find the source of longToByteArray(long a)
public static byte[] longToByteArray(long a)
//package com.java2s; public class Main { public static byte[] longToByteArray(long a) { byte[] bArray = new byte[8]; for (int i = 0; i < bArray.length; i++) { bArray[i] = new Long(a & 0XFF).byteValue(); a >>= 8;/*w w w .j ava2 s . c om*/ } return bArray; } }