Here you can find the source of long2bytes(long num)
public static byte[] long2bytes(long num)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] long2bytes(long num) { byte[] b = new byte[8]; for (int i = 0; i < 8; i++) { b[i] = (byte) (num >>> (56 - i * 8)); }/*ww w . j a v a2s.c o m*/ return b; } }