Here you can find the source of getUnsignedBigInteger(byte[] data, int start, int length)
Parameter | Description |
---|---|
data | - A byte[] containing the data to convert |
start | - An int representing the position of the first byte to copy. |
length | - An int representing the number of bytes to process. |
public static BigInteger getUnsignedBigInteger(byte[] data, int start, int length)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; public class Main { /**/*from w ww .java 2s .com*/ * Returns a positive BigInteger from the given bytes. (Big endian) * * @param data - A byte[] containing the data to convert * @param start - An int representing the position of the first byte to copy. * @param length - An int representing the number of bytes to process. * * @return A BigInteger created from the given bytes. */ public static BigInteger getUnsignedBigInteger(byte[] data, int start, int length) { if (length == 0) { return BigInteger.ZERO; } byte[] value = new byte[length + 1]; System.arraycopy(data, start, value, 1, length); return new BigInteger(value); } }