Friday, May 25, 2012

Calculate the power of a number in Java

To calculate the result of "power of number" in Java, calling the method:

static double pow(double a, double b)

It returns the value of the first argument (a) raised to the power of the second argument (b).

Reference: java.lang.Math

PS. ^ operator in Java is Bitwise exclusive OR.


No comments:

Post a Comment