Here you can find the source of toLong(byte[] buf)
public final static long toLong(byte[] buf)
//package com.java2s; public class Main { public final static long toLong(byte[] buf) { long result = 0; for (int i = 0; i < buf.length; i++) { long k = buf[i] & 0xff; long t = k << (i * 8); result |= t;/*from w w w . java2 s . co m*/ } return result; } }