Here you can find the source of longToByte(long number)
public static byte[] longToByte(long number)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] longToByte(long number) { byte[] b = new byte[8]; for (int i = 7; i >= 0; i--) { b[i] = (byte) (number % 256); number >>= 8;/*from w ww. j ava2s .co m*/ } return b; } }