Here you can find the source of toLong(byte[] value)
public static long toLong(byte[] value)
//package com.java2s; //License from project: Open Source License public class Main { public static long toLong(byte[] value) { return toLong(value, 0); }// w w w .j a va 2s. co m /** * byte[] -> long * * @param value * @param offset * @return */ public static long toLong(byte[] value, int offset) { long result = 0L; result = result | (value[7] & 0xff); result = result | (((long) value[offset + 6] & 0xff) << 8); result = result | (((long) value[offset + 5] & 0xff) << 16); result = result | (((long) value[offset + 4] & 0xff) << 24); result = result | (((long) value[offset + 3] & 0xff) << 32); result = result | (((long) value[offset + 2] & 0xff) << 40); result = result | (((long) value[offset + 1] & 0xff) << 48); result = result | (((long) value[offset + 0] & 0xff) << 56); return result; } }