Java Utililty Methods BigInteger From

List of utility methods to do BigInteger From

Description

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

Method

BigIntegerbyteArrayToBigInteger(final byte[] data)
Convert a BCD byte[] to BigInteger
StringBuilder stringBuilder = new StringBuilder(data.length * 2);
for (final byte aData : data) {
    int digit = (aData & 0xF0) >> 4;
    if (digit < 0 || digit > 9) {
        throw new IllegalArgumentException("Invalid digit: " + digit);
    stringBuilder.append((char) (digit + 0x30));
    digit = aData & 0x0F;
...
BigIntegerByteArrayToBigIntegerWithoutSign(byte[] array)
Convert an array of bytes to a non-negative big integer.
return new BigInteger(1, array);
BigIntegerbytesToBigInteger(byte[] buffer)
This function converts the bytes in a byte array to its corresponding big integer value.
return new BigInteger(buffer);
BigIntegerbytesToBigInteger(byte[] data)
bytes To Big Integer
return new BigInteger(1, data);
BigIntegerbytesToBigInteger(byte[] data, int[] offset)
Return the BigInteger represented by the bytes in data staring at offset offset[0].
int length = bytesToInt(data, offset);
byte[] bytes = new byte[length];
offset[0] += memcpy(bytes, 0, data, offset[0], length);
return new BigInteger(bytes);
BigIntegerconvertToBigInteger(String s)
convert To Big Integer
if ((s == null) || s.equals("")) {
    return null;
if (s.startsWith("+")) {
    s = s.substring(1);
return convertToInteger(s);
BigIntegerconvertToBigInteger(String sequence)
convert To Big Integer
BigInteger biSequence = BigInteger.ZERO;
int kmerSize = sequence.length();
for (int i = 0; i < kmerSize; i++) {
    char ch = sequence.charAt(i);
    if (ch == 'A') {
        biSequence = biSequence.add(BigInteger.valueOf(0));
    } else if (ch == 'C') {
        biSequence = biSequence.add(BigInteger.valueOf(1));
...
BigIntegergetUnsignedBigInteger(byte[] data, int offset, int length)
Returns a positive BigInteger from the given bytes.
if (length == 0) {
    return BigInteger.ZERO;
byte[] value = new byte[length + 1];
System.arraycopy(data, offset, value, 1, length);
return new BigInteger(value);
BigIntegergetUnsignedBigInteger(long x)
Ensure that the passed long parameter will be interpreted as a positive value.
BigInteger z = BigInteger.valueOf(x);
if (z.signum() < 0)
    return z.add(x64);
else
    return z;
BigIntegerstring2BigInteger(String plaintext)
String 2 big integer big integer.
String msg = base64Encode(plaintext);
return toBigInteger(msg);