Here you can find the source of long2bytes(long value, byte[] bytes, int offset)
public static void long2bytes(long value, byte[] bytes, int offset)
//package com.java2s; //License from project: Apache License public class Main { public static void long2bytes(long value, byte[] bytes, int offset) { for (int i = 7; i > -1; i--) { bytes[offset++] = (byte) ((value >> 8 * i) & 0xFF); }/*from w w w . j a v a 2s. c o m*/ } }