ceil() 向上取整
// 方法 结果
System.out.println(Math.ceil(11.11)); //12.0
System.out.println(Math.ceil(-11.11)); //-11.0
floor() 向下取整
// 方法 结果
System.out.println(Math.floor(11.11)); //11.0
System.out.println(Math.floor(-11.11)); //-12.0
round()用于计算小数四舍五入的结果
// 方法 结果
System.out.println(Math.round(11.11)); //11.0
System.out.println(Math.round(-11.11)); //-11.0
max() 比较最大值 、min()比较最小值
int a=5;
// 方法 结果
System.out.println(Math.max(11.11,a)); //11.11
System.out.println(Math.min(11.11,a)); //5.0
random()生成一个大于0.0且小于1.0的随机数
// 方法 结果
System.out.println(Math.random()); //0.749124427833664
此处是本人认为比较常见且常用的方法更多方法详见Api :Java Math类