using math. pow code example
Example 1: how to use pow function in java
import java.lang.Math;
class Gfg {
// driver code
public static void main(String args[])
{
double a = 30;
double b = 2;
System.out.println(Math.pow(a, b));
a = 3;
b = 4;
System.out.println(Math.pow(a, b));
a = 2;
b = 6;
System.out.println(Math.pow(a, b));
}
Example 2: js pow
Math.pow(base, exponent);
Math.pow(2, 4);
// Outputs 16
// The same as going 2^4, 2 to the power of 4