向上取整
System.out.println((int) Math.ceil(66.1));
结果
67
向下取整
System.out.println((int) Math.floor(66.6));
结果
66
四舍五入
System.out.println(Math.round(66.1));
结果
66
System.out.println(Math.round(66.6));
结果
67
向上取整
System.out.println((int) Math.ceil(66.1));
结果
67
向下取整
System.out.println((int) Math.floor(66.6));
结果
66
四舍五入
System.out.println(Math.round(66.1));
结果
66
System.out.println(Math.round(66.6));
结果
67
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。