List of utility methods to do BigInteger Power Calculate
BigInteger | pow(final BigInteger k, BigInteger e) Raise a BigInteger to a BigInteger power. if (e.compareTo(BigInteger.ZERO) < 0) { throw new NotPositiveException(LocalizedFormats.EXPONENT, e); BigInteger result = BigInteger.ONE; BigInteger k2p = k; while (!BigInteger.ZERO.equals(e)) { if (e.testBit(0)) { result = result.multiply(k2p); ... |
BigInteger | pow(final BigInteger k, int e) Raise a BigInteger to an int power. if (e < 0) { throw new NotPositiveException(LocalizedFormats.EXPONENT, e); return k.pow(e); |
BigInteger | pow(final BigInteger k, long e) Raise a BigInteger to a long power. if (e < 0) { throw new NotPositiveException(LocalizedFormats.EXPONENT, e); BigInteger result = BigInteger.ONE; BigInteger k2p = k; while (e != 0) { if ((e & 0x1) != 0) { result = result.multiply(k2p); ... |