Here you can find the source of longToBytes(long value)
public static byte[] longToBytes(long value)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] longToBytes(long value) { return new byte[] { (byte) (value & 0xFF), (byte) ((value >> 8) & 0xFF), (byte) ((value >> 16) & 0xFF), (byte) ((value >> 24) & 0xFF), (byte) ((value >> 32) & 0xFF), (byte) ((value >> 40) & 0xFF), (byte) ((value >> 48) & 0xFF), (byte) ((value >> 56) & 0xFF) }; }/*from w w w. j a v a 2 s . co m*/ }