Here you can find the source of bytesToLong(byte[] bytes)
public static long bytesToLong(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { public static long bytesToLong(byte[] bytes) { return (0xffL & (long) bytes[0]) | (0xff00L & ((long) bytes[1] << 8)) | (0xff0000L & ((long) bytes[2] << 16)) | (0xff000000L & ((long) bytes[3] << 24)) | (0xff00000000L & ((long) bytes[4] << 32)) | (0xff0000000000L & ((long) bytes[5] << 40)) | (0xff000000000000L & ((long) bytes[6] << 48)) | (0xff00000000000000L & ((long) bytes[7] << 56)); }//from w ww . j av a 2s . c o m }