测试数据:
System.out.println("不小于它的最小整数\tMath.ceil(1.1):"+Math.ceil(1.1));
System.out.println("不大于它的最大整数\tMath.ceilfloor(1.9):"+Math.floor(1.9));
System.out.println("四舍五入\tMath.round(1.1):"+Math.round(1.1));
System.out.println("四舍五入\tMath.round(1.5):"+Math.round(1.5));
System.out.println("四舍五入\tMath.round(-1.5):"+Math.round(-1.5));
测试结果:
不小于它的最小整数 Math.ceil(1.1):2.0
不大于它的最大整数 Math.ceilfloor(1.9):1.0
四舍五入 Math.round(1.1):1
四舍五入 Math.round(1.5):2
四舍五入 Math.round(-1.5):-1