Round Java float and double numbers using Math.round
public class Main { public static void main(String[] args) { System.out.println(Math.round(10f)); System.out.println(Math.round(2.5f)); System.out.println(Math.round(-1.4f)); System.out.println(Math.round(-2.5f)); } } /* 10 3 -1 -2 */