Int i 2.
Java math pow integer.
Public biginteger pow int exponent parameters.
Int square math pow i 2.
In math 2 8 2x2x2x2x2x2x2x2 256 in java math pow 2 8.
There are some special cases as listed below.
Double dblresult math pow 4 2 3.
The java lang math pow is used to calculate a number raise to the power of some other number.
The java lang math pow double a double b returns the value of the first argument raised to the power of the second argument.
Square a number with the math pow method.
The exponent is an integer rather than a biginteger.
The output will be 74 08800000000001.
The java lang math pow is used to return the value of first argument raised to the power of the second argument.
Special cases if the second argument is positive or negative zero then the result is 1 0.
In general i just multiply the number by itself to get the squared value but the advantage of the math pow method is that once you know how to use it you can easily cube a.
The java math biginteger pow int exponent returns a biginteger whose value is this exponent.
The output will be 8.
If the base is negative and the exponent is not an integer the result is nan.
Here s how you call the math pow method to square a number.
This function accepts two parameters and returns the value of first parameter raised to the second parameter.
Because pow is a static method of math you always use it as math pow rather than as a method of a math object you created math has no constructor.
Public biginteger pow int exponent.
If the second argument is not a number nan this method will return nan.
Int intresult int math pow 2 3.
Let s now pass a double as an argument and see the results.
If the second argument is 1 0 then the result is the same as the first argument.
Following is the declaration for java math biginteger pow method.
A simple math pow example display 2 to the power of 8.