java.lang.Math.round(float a)


java.lang.Math.round(float a)

package com.codingdict;



import java.lang.*;



public class MathDemo {



   public static void main(String[] args) {



      // get two float numbers

      float x = 1654.9874f;

      float y = -9765.134f;



      // find the closest int for these floats

      System.out.println("Math.round(" + x + ")=" + Math.round(x));

      System.out.println("Math.round(" + y + ")=" + Math.round(y));

   }

}