Here you can find the source of longToByteArray(long value)
public static final byte[] longToByteArray(long value)
//package com.java2s; //License from project: LGPL import java.nio.ByteBuffer; public class Main { public static final byte[] longToByteArray(long value) { return ByteBuffer.allocate(Long.SIZE / Byte.SIZE).putLong(value).array(); }// w w w .ja va 2 s. c o m }