Java Utililty Methods BigInteger Calculate

List of utility methods to do BigInteger Calculate

Description

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

Method

NumberdecodeFloat(BigInteger rawSign, BigInteger rawExponent, BigInteger rawMantissa, int signWidth, int exponentWidth, int mantissaWidth, int bias, MathContext mc)
decode Float
if (signWidth < 0 || signWidth > 1 || exponentWidth < 0 || mantissaWidth < 0)
    throw new IllegalArgumentException();
else if (rawExponent.compareTo(BigInteger.ZERO) == 0) {
    if (rawMantissa.compareTo(BigInteger.ZERO) == 0) {
        boolean isNegative = (rawSign.compareTo(BigInteger.ZERO) != 0);
        return isNegative ? -0.0 : 0.0;
    } else {
        boolean isNegative = (rawSign.compareTo(BigInteger.ZERO) != 0);
...
BigIntegerdecodeToBigInteger(String input)
decode To Big Integer
return new BigInteger(1, decode(input));
BigInteger[]DiffieHellman(BigInteger p, BigInteger g, BigInteger x, BigInteger y, BigInteger y_B)
Diffie Hellman
if (y == null)
    y = g.modPow(x, p);
BigInteger k = null;
if (y_B != null)
    k = y_B.modPow(x, p);
return new BigInteger[] { y, k };
intdistance(BigInteger a, BigInteger b)
distance
int ia = a.intValue();
int ib = b.intValue();
if (ib >= ia)
    return ib - ia;
return ib + (int) Math.pow(2, M) - ia;
BigIntegerdistance(BigInteger a, BigInteger b)
return the distance between two number, that is |a-b|.
return a.subtract(b).abs();
BigIntegerdiv(BigInteger dividend, BigInteger divisor)
div
return dividend.divide(divisor);
BigIntegerdivide(BigInteger dividend, BigInteger divisor)
Divides the given dividend by the divisor.
BigInteger result = null;
if (dividend != null && divisor != null) {
    result = dividend.divide(divisor);
return result;
Stringdump(BigInteger x)

Returns a hexadecimal dump of the trimmed bytes of a BigInteger .

return dumpString(trim(x));
voiddumpBitLengthOfValues(BigInteger... data)
dump Bit Length Of Values
System.out.println("Bitlengths:");
for (BigInteger bigInt : data) {
    System.out.println(bigInt.bitLength());
StringdumpDataPathId(BigInteger datapathId)
dump Data Path Id
return datapathId.toString(16);