Here you can find the source of toLong(byte[] b, int pos)
public static long toLong(byte[] b, int pos)
//package com.java2s; public class Main { public static long toLong(byte[] b, int pos) { return toLong(b, pos, 8); }//w ww .ja v a2 s . c o m public static long toLong(byte[] b, int pos, int width) { long ret = 0; for (int i = 0; i < width; i++) { ret |= (b[i + pos] & 0xFFl) << (8 * i); } return ret; } }