StrictMath.round(float a) has the following syntax.
public static int round(float a)
In the following code shows how to use StrictMath.round(float a) method.
//from w ww. j ava2 s . c o m public class Main { public static void main(String[] args) { float f1 = 12.34f , f2 = 56.78f; System.out.println("closest int value to " + f1 + " = " + StrictMath.round(f1)); System.out.println("closest int value to " + f2 + " = " + StrictMath.round(f2)); } }
The code above generates the following result.