Here you can find the source of toLong(byte[] in)
public static long toLong(byte[] in)
//package com.java2s; //License from project: LGPL public class Main { public static long toLong(byte[] in) { long out = 0; for (int i = in.length - 1; i > 0; i--) { out |= in[i] & 0xff;//from w w w .j a v a 2s . c o m out <<= 8; } out |= in[0] & 0xff; return out; } }