109
Java Math.rint() method
The java.lang.Math.rint() is used to round the argument to nearest mathematical integer.
Syntax
Parameter
Return
- If the argument is positive or negative number, this method will return the nearest value.
- If two double values that are mathematical integers are equally close, this method will return integer value that is even.
- If the argument is NaN or infinity or positive zero or negative zero, this method will return the argument value as a result.
Example 1
Output:
82.0
Example 2
Output:
-37.0
Example 3
Output:
80.0 80.0
Example 4
Output:
Infinity
Next TopicJava Math