Java常用API(Math类)
Math类的作用
1 public class Test { 2 public static void main(String[] args) { 3 double a=-5.4; 4 System.out.println("绝对值是:"+Math.abs(a)); 5 System.out.println("向下取整:"+Math.floor(a)); 6 System.out.println("向上取整:"+Math.ceil(a)); 7 System.out.println("四舍五入:"+Math.round(a)); 8 9 } 10 }
以上就是Math类的一些基本操作,更多方法查询API文档
若有错误还请各位读者批评指正
原文:https://www.cnblogs.com/pjhaymy/p/13255850.html