Here you can find the source of bytes2Long(byte[] bytes, int offset)
public static long bytes2Long(byte[] bytes, int offset)
//package com.java2s; //License from project: Apache License public class Main { public static long bytes2Long(byte[] bytes, int offset) { int count = 8; if (bytes.length - offset < 8) { count = bytes.length - offset; }// www .j a v a2 s . c o m long num = 0; byte high = bytes[offset + count - 1]; if (high < 0) { num = -1; } for (int i = count - 1; i >= 0; --i) { num <<= 8; num |= (bytes[i + offset] & 0xFF); } return num; } }