Here you can find the source of longToByteArray(long i64)
public static byte[] longToByteArray(long i64)
//package com.java2s; //License from project: Apache License public class Main { private static byte[] i64out = new byte[8]; public static byte[] longToByteArray(long i64) { i64out[0] = (byte) (0xff & (i64 >> 56)); i64out[1] = (byte) (0xff & (i64 >> 48)); i64out[2] = (byte) (0xff & (i64 >> 40)); i64out[3] = (byte) (0xff & (i64 >> 32)); i64out[4] = (byte) (0xff & (i64 >> 24)); i64out[5] = (byte) (0xff & (i64 >> 16)); i64out[6] = (byte) (0xff & (i64 >> 8)); i64out[7] = (byte) (0xff & (i64)); return i64out; }/*from w ww.j a v a 2 s.co m*/ }