Here you can find the source of longToBytes(long n, byte b[], int offset)
public static void longToBytes(long n, byte b[], int offset)
//package com.java2s; //License from project: Open Source License public class Main { public static void longToBytes(long n, byte b[], int offset) { for (int i = 0; i < 8; i++) { b[offset + i] = (byte) (n & 0xff); n = n >> 8;// www. j av a 2 s. c o m } } }