How to use Math.pow in Java?

Math.pow raises a number to the power of another number.

Most common use case is to square a number:

double squareOfTwo = Math.pow(2, 2);

System.out.println(squareOfTwo); // 4.0

That said, the second argument can be any number:

double threeToThePowerOfTen = Math.pow(3, 10);

System.out.println(threeToThePowerOfTen); // 59049.0