Javatpoint Logo
Javatpoint Logo

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

Test it Now

Output:

82.0

Example 2

Test it Now

Output:

-37.0

Example 3

Test it Now

Output:

80.0
80.0

Example 4

Test it Now

Output:

Infinity

Next TopicJava Math




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA