Here you can find the source of toLong(byte[] b)
public static long toLong(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { public static long toLong(byte[] b) { long s = 0; long s0 = b[0] & 0xff; long s1 = b[1] & 0xff; long s2 = b[2] & 0xff; long s3 = b[3] & 0xff; long s4 = b[4] & 0xff; long s5 = b[5] & 0xff; long s6 = b[6] & 0xff; long s7 = b[7] & 0xff; s1 <<= 8;//w w w. j av a 2 s .co m s2 <<= 16; s3 <<= 24; s4 <<= 8 * 4; s5 <<= 8 * 5; s6 <<= 8 * 6; s7 <<= 8 * 7; s = s0 | s1 | s2 | s3 | s4 | s5 | s6 | s7; return s; } }