向上取整:Math.ceil(double a)
向下取整:Math.floor(double a)
四舍五入取整:Math.round(double a)
例:
Math.ceil(24.1)–> 25
Math.floor(24.8)–> 24
Math.round(24.1)–> 24
Math.round(24.8)–> 25
数学取整方法解析
向上取整:Math.ceil(double a)
向下取整:Math.floor(double a)
四舍五入取整:Math.round(double a)
例:
Math.ceil(24.1)–> 25
Math.floor(24.8)–> 24
Math.round(24.1)–> 24
Math.round(24.8)–> 25
6762

被折叠的 条评论
为什么被折叠?