Here you can find the source of longToByteArray(long value, byte[] byteArray)
public static final void longToByteArray(long value, byte[] byteArray)
//package com.java2s; //License from project: Open Source License public class Main { public static final void longToByteArray(long value, byte[] byteArray) { byteArray[7] = (byte) (value & 0xFF); byteArray[6] = (byte) ((value >>> 8) & 0xFF); byteArray[5] = (byte) ((value >>> 16) & 0xFF); byteArray[4] = (byte) ((value >>> 24) & 0xFF); byteArray[3] = (byte) ((value >>> 32) & 0xFF); byteArray[2] = (byte) ((value >>> 40) & 0xFF); byteArray[1] = (byte) ((value >>> 48) & 0xFF); byteArray[0] = (byte) (value >>> 56); }// w w w . ja va 2 s. c om public static final void longToByteArray(long value, byte[] byteArray, int offset) { byteArray[7 + offset] = (byte) (value & 0xFF); byteArray[6 + offset] = (byte) ((value >>> 8) & 0xFF); byteArray[5 + offset] = (byte) ((value >>> 16) & 0xFF); byteArray[4 + offset] = (byte) ((value >>> 24) & 0xFF); byteArray[3 + offset] = (byte) ((value >>> 32) & 0xFF); byteArray[2 + offset] = (byte) ((value >>> 40) & 0xFF); byteArray[1 + offset] = (byte) ((value >>> 48) & 0xFF); byteArray[offset] = (byte) (value >>> 56); } }