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