Java Utililty Methods BigInteger Parse

List of utility methods to do BigInteger Parse

Description

The list of methods to do BigInteger Parse are organized into topic(s).

Method

BigIntegergetBigInteger(byte[] payload, int offset, int length)
get Big Integer
byte[] arr = new byte[length + 1];
arr[0] = 0;
for (int i = 0; i < length; i++) {
    arr[i + 1] = payload[offset + length - 1 - i];
return new BigInteger(arr);
BigIntegergetBigInteger(Console console, Function validator)
get Big Integer
if (validator == null)
    validator = value -> true;
String answer;
BigInteger value;
do {
    answer = readLine(console);
    try {
        value = new BigInteger(answer);
...
BigIntegergetBigInteger(Number number)
get Big Integer
BigInteger bigInteger = null;
if (isByteShortIntegerOrLong(number)) {
    bigInteger = BigInteger.valueOf(number.longValue());
} else if (isFloatOrDouble(number)) {
    bigInteger = new BigDecimal(number.doubleValue()).toBigInteger();
} else if (number instanceof BigInteger) {
    bigInteger = (BigInteger) number;
} else if (number instanceof BigDecimal) {
...
BigIntegergetBigInteger(Number value)
Utility method used to convert a Number into a BigInteger.
BigInteger result = null;
if (value != null) {
    if (value instanceof BigInteger) {
        result = (BigInteger) value;
    } else {
        result = BigInteger.valueOf(Math.round(value.doubleValue()));
return (result);
BigIntegergetBigInteger(String value)
Get big integer from a string.
BigInteger bint = null;
try {
    bint = new BigInteger(value);
} catch (NumberFormatException e) {
    return null;
return bint;
BigInteger[]getBigIntegerArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class.
long[] d = getLongArrayFromByteArray(buf);
BigInteger[] a = new BigInteger[d.length];
for (int i = 0; i < a.length; i++) {
    a[i] = BigInteger.valueOf(d[i]);
return a;
BigIntegergetBigIntegerValue(final Integer value)
Returns the BigInteger value of the Integer value passed if the value passed is not null, otherwise returns null.
BigInteger result = null;
if (value != null) {
    result = BigInteger.valueOf(value);
return result;
StringgetBinaryNumberInString(BigInteger integerNumber)
This method gets the binary representation of any integer number.
The binary representation is returned in String format
return integerNumber.toString(BINARY_RADIX);
BigIntegertoBigInteger(String bigInteger)
Wandelt einen String in einen BigInteger um
if (null == bigInteger)
    return null;
BigInteger value = null;
try {
    value = new BigInteger(bigInteger);
} catch (NumberFormatException e) {
return value;
...
BigIntegertoBigInteger(String s)
to Big Integer
return new BigInteger(s);