Double a = 3.14;
System.out.println(Math.round(a)); // 3
System.out.println(Math.ceil(a)); // 4.0
System.out.println(Math.floor(a)); // 3.0
Double b = 3.84;
System.out.println(Math.round(b)); // 4
System.out.println(Math.ceil(b));// 4.0
System.out.println(Math.floor(b));// 3.0
Math.round 四舍五入
Math.ceil 向上取整
Math.floor 向下取整