Get the round value for integer in Java

Description

The following code shows how to get the round value for integer.

Example


//from  ww  w. ja v  a2 s  .  c o m
public class Main {
    public static void main(String[] args) {
        double aNumber = -191.635;

        System.out.println("The rint of " + aNumber + " is " + Math.rint(aNumber));
    }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Development »




Java Algorithms
Java Clipboard
Java Compiler
Java Desktop
Java Virtual Machine
Java Math
OS
Random
Java Robot
Java RuntimeMXBean
Java Timer
Java UUID
Java Internationalization