Here you can find the source of longToBigEndian(long value, byte[] in, int offset)
public static void longToBigEndian(long value, byte[] in, int offset)
//package com.java2s; public class Main { public static void longToBigEndian(long value, byte[] in, int offset) { if (in == null) { throw new NullPointerException("in == null"); }//from w w w . ja va 2s . c om if ((in.length - offset) < 8) { throw new IllegalArgumentException("not enough space in array"); } in[offset] = (byte) ((value >> 56) & 0xff); in[offset + 1] = (byte) ((value >> 48) & 0xff); in[offset + 2] = (byte) ((value >> 40) & 0xff); in[offset + 3] = (byte) ((value >> 32) & 0xff); in[offset + 4] = (byte) ((value >> 24) & 0xff); in[offset + 5] = (byte) ((value >> 16) & 0xff); in[offset + 6] = (byte) ((value >> 8) & 0xff); in[offset + 7] = (byte) ((value) & 0xff); } }