// 获取绝对值
System.out.println(Math.abs(3.14)); // 3.14
System.out.println(Math.abs(-2.4)); // 2.4
// 向上取整
System.out.println(Math.ceil(2.1)); // 3.0
// 向下取整
System.out.println(Math.floor(2.9)); // 2.0
// round(num) : 四舍五入
System.out.println(Math.round(2.4)); // 2
System.out.println(Math.round(2.5)); // 3
System.out.println(Math.round(2.6)); // 3
System.out.println(Math.PI); // 3.141592653589793
原文:https://www.cnblogs.com/nichengshishaonian/p/11965541.html