核心提示:舍掉小数取整:Math.floor(2.0)=2 舍掉小数取整:Math.floor(2.1)=2 舍掉小数取整:Math.floor(2.5)=2 舍掉小数取整:Math.floor(2.9)=2 舍掉小数取整:Math.floor(-2.0)=-2 舍掉小数取整:Math.floor(-2.1)=-3 舍掉小数取整:Math.floor(-2.5)=-3 舍掉小数取整:Mat
舍掉小数取整:Math.floor(2.0)=2 舍掉小数取整:Math.floor(-2.0)=-2 四舍五入取整:Math.rint(2.0)=2 四舍五入取整:Math.rint(-2.0)=-2 凑整:Math.ceil(2.0)=2 凑整:Math.ceil(-2.0)=-2 四舍五入取整:Math.round(2.0)=2 四舍五入取整:Math.round(-2.0)=-2 |
|
来自: caotuer > 《java基础知识》