Here you can find the source of byteToLong(byte[] b)
public static long byteToLong(byte[] b)
//package com.java2s; //License from project: Open Source License public class Main { public static long byteToLong(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;//ww w . ja v a 2 s .c om 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; } }