Java StrictMath.round(double a)
Syntax
StrictMath.round(double a) has the following syntax.
public static long round(double a)
Example
In the following code shows how to use StrictMath.round(double a) method.
// w w w . jav a2s.c o m
public class Main {
public static void main(String[] args) {
double d1 = 12.34 , d2 = 56.78;
System.out.println("closest long value to " + d1 + " = " + StrictMath.round(d1));
System.out.println("closest long value to " + d2 + " = " + StrictMath.round(d2));
}
}
The code above generates the following result.