Java Utililty Methods BigInteger to

List of utility methods to do BigInteger to

Description

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

Method

StringtoStr(BigInteger number)
to Str
StringBuilder plaintext = new StringBuilder(BLOCK_SIZE + 1);
String plaintextNumber = number.toString();
plaintextNumber = plaintextNumber.substring(1, plaintextNumber.length());
for (int i = 0; i < plaintextNumber.length(); i += 3) {
    String blockString = plaintextNumber.substring(i, i + 3);
    int block = Integer.parseInt(blockString);
    plaintext.append((char) block);
return plaintext.toString();
StringtoString(BigInteger bi)
Converte de BigInteger para String
return bi.toString(16);
StringtoString(BigInteger[] vector)
BigInteger array to string
if (vector.length == 0)
    return "[]";
String result = "[" + vector[0];
for (int i = 1; i < vector.length; i++)
    result += "," + vector[i];
return result + "]";
long[]toUnsigned(final BigInteger[] ulong)
to Unsigned
final long[] retVal = new long[ulong.length];
for (int i = 0; i < retVal.length; i++) {
    retVal[i] = toUnsigned(ulong[i]);
return retVal;
BigIntegertoUnsignedBigInteger(long i)
Return a BigInteger equal to the unsigned value of the argument.
if (i >= 0L)
    return BigInteger.valueOf(i);
else {
    int upper = (int) (i >>> 32);
    int lower = (int) i;
    return (BigInteger.valueOf(toUnsignedLong(upper))).shiftLeft(32)
            .add(BigInteger.valueOf(toUnsignedLong(lower)));
BigIntegertoUnsignedBigInteger(long number)
to Unsigned Big Integer
return number < 0L ? BigInteger.ONE.shiftLeft(64).add(BigInteger.valueOf(number))
        : BigInteger.valueOf(number);