Logo

Programming-Idioms

History of Idiom 66 > diff from v1 to v2

Edit summary for version 2 by :

Version 1

2015-04-26, 12:05:25

Version 2

2015-04-26, 16:41:13

Idiom #66 Big integer exponentiation

Calculate the result z of x power n, where x is a big integer and n is a positive integer.

Idiom #66 Big integer exponentiation

Calculate the result z of x power n, where x is a big integer and n is a positive integer.

Imports
import java.math.BigInteger;
Code
BigInteger z = x.pow(n);
Comments bubble
This leaves x unchanged.
Demo URL
http://ideone.com/cDCzYo