java中如何取整?

Python012

java中如何取整?,第1张

有float类型的

向上取整:Math.ceil() //只要有小数都+1

向下取整:Math.floor() //不取小数

四舍五入:Math.round() //四舍五入

有float类型的\x0d\x0a\x0d\x0a向上取整:Math.ceil() //只要有小数都+1\x0d\x0a向下取整:Math.floor() //不取小数\x0d\x0a四舍五入:Math.round() //四舍五入