Here you can find the source of longToByteArray(long value, byte[] dest)
public static void longToByteArray(long value, byte[] dest)
//package com.java2s; //License from project: Open Source License public class Main { public static void longToByteArray(long value, byte[] dest) { int lastIndex = dest.length - 1; for (int i = lastIndex; i >= 0; i--) { dest[i] = (byte) (value & 0xff); value = value >> 8;//from w w w . j a v a 2 s .co m } } }