StrictMath.rint(double a) has the following syntax.
public static double rint(double a)
In the following code shows how to use StrictMath.rint(double a) method.
//from w ww . j a v a 2 s . c om public class Main { public static void main(String[] args) { double d1 = 1.2 , d2 = 34.5 , d3 = 6.7; System.out.println("integer value closest to " + d1 + " = " + StrictMath.rint(d1)); System.out.println("integer value closest to " + d2 + " = " + StrictMath.rint(d2)); System.out.println("integer value closest to " + d3 + " = " + StrictMath.rint(d3)); } }
The code above generates the following result.