Here you can find the source of toLong(byte[] b, int off, boolean bigEndian)
public static long toLong(byte[] b, int off, boolean bigEndian)
//package com.java2s; //License from project: Open Source License public class Main { public static long toLong(byte[] b, int off, boolean bigEndian) { if (bigEndian) { return (((long) (b[0] & 0xff)) << 56) | (((long) (b[1] & 0xff)) << 48) | (((long) (b[2] & 0xff)) << 40) | (((long) (b[3] & 0xff)) << 32) | (((long) (b[4] & 0xff)) << 24) | (((long) (b[5] & 0xff)) << 16) | (((long) (b[6] & 0xff)) << 8) | ((long) (b[7] & 0xff)); } else {//w ww.java2 s. c o m return (((long) (b[7] & 0xff)) << 56) | (((long) (b[6] & 0xff)) << 48) | (((long) (b[5] & 0xff)) << 40) | (((long) (b[4] & 0xff)) << 32) | (((long) (b[3] & 0xff)) << 24) | (((long) (b[2] & 0xff)) << 16) | (((long) (b[1] & 0xff)) << 8) | ((long) (b[0] & 0xff)); } } public static void toLong(long[] l, int lOff, byte[] b, int bOff, int bLen, boolean bigEndian) { int bEnd = bOff + bLen; for (int j = bOff, k = lOff; j < bEnd; j += 8, k++) { l[k] = toLong(b, j, bigEndian); } } }