Java tutorial
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; public class Main { public static BigInteger byteArrayToBigInteger(byte[] b, int offset, int length) { if (b.length < offset + length) { throw new IllegalArgumentException("offset + length must be less than or equal to b.length"); } BigInteger value = BigInteger.valueOf(0); for (int i = 0; i < length; i++) { value = value.shiftLeft(8); value = value.add(BigInteger.valueOf(b[i + offset] & 0x000000ff)); } return value; } }