Answers for "how to round to the closes whole number in java"

6

how to round up in java

int x = 3.14;

Math.round(x);
//Rounds to nearest int
Math.ceil(x);
//Rounds up to int
Math.floor(x);
//Rounds down to int
Posted by: Guest on September-30-2020
-1

java round to nearest 5

5*(Math.round(number/5));
Posted by: Guest on May-31-2021

Code answers related to "how to round to the closes whole number in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language