how does math.rint work
The Java Math rint() method returns a value that is closest to the specified value and is equal to the mathematical integer. That is, if the specified value is 5.8, the closest value that is equal to the mathematical integer is 6.0. And, for value 5.4, the closest value that is equal to mathematical integer is 5.0.