JAVA Math的简单运用

package Demo505;
//Math 还有很多方法,可以自行在API中查询使用


public class CodeMath {
public static void main(String[] args) {
System.out.println(Math.abs(-6.6)); //绝对值
System.out.println(Math.ceil(6.6)); //向上取整
System.out.println(Math.floor(6.6));//向下取整
System.out.println(Math.round(7.7));//四舍五入
}
}
运行代码↓
 
原文地址:https://www.cnblogs.com/Ssinoo/p/10828682.html