Java BigInteger pow() method

The pow() method of Java BigInteger class is used to calculate the power of BigInteger value. This method returns a BigInteger whose value is (thisexponent ).

Syntax:

Parameter:

exponent- exponent to which this BigInteger is to be raised.

Returns:

This method returns (thisexponent ).

Exception:

ArithmeticException- exponent is negative.

Note: An exponent should be an integer rather than a BigInteger.

Example 1

Test it Now

Output:

13^2 is 169

Example 2

Test it Now

Output:

100^3 is 1000000

Example 3

Test it Now

Output:

java.lang.ArithmeticException: Negative exponent

Next TopicJava BigInteger




Latest Courses