Here you can find the source of unpackLong(byte[] arr, int i, int j)
private static long unpackLong(byte[] arr, int i, int j)
//package com.java2s; /*//from w ww .ja va2 s . co m * Copyright (c) 2004-2011 Marco Maccaferri and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Marco Maccaferri - initial API and implementation */ public class Main { private static long unpackLong(byte[] arr, int i, int j) { if (arr.length < i + j) { return 0L; } long l = 0L; int k = (j - 1) * 8; for (int i1 = 0; i1 < j; i1++) { l += byteToInt(arr[i + i1]) << k; k -= 8; } return l; } public static int byteToInt(byte b) { int i = b; if (b < 0) { i = 256 + b; } return i; } }