Here you can find the source of toLong(byte... b)
public static long toLong(byte... b)
//package com.java2s; //License from project: Open Source License public class Main { public static long toLong(byte... b) { int mask = 0xff; int temp = 0; long res = 0; int byteslen = b.length; if (byteslen > 8) { return Long.valueOf(0L); }/*from w w w . java 2 s.c o m*/ for (int i = 0; i < byteslen; i++) { res <<= 8; temp = b[i] & mask; res |= temp; } return res; } }