说一下Java的math类中几个常见的方法:
1.Math.random() 返回一个[0.0,1.0)之间的伪随机数 ,左开右闭.
2.Math.round() 四舍五入
Math.round(2.6) ----> 结果为3
Math.round(-1.5) ----> 结果为-1
3.Math.pow(x,y) x的y次方
4.Math.abs() 绝对值
5.Math.min(x,y) 返回两个数中小的那个
6.Math.max(x,y) 返回两个数中大的那个
说一下Java的math类中几个常见的方法:
1.Math.random() 返回一个[0.0,1.0)之间的伪随机数 ,左开右闭.
2.Math.round() 四舍五入
Math.round(2.6) ----> 结果为3
Math.round(-1.5) ----> 结果为-1
3.Math.pow(x,y) x的y次方
4.Math.abs() 绝对值
5.Math.min(x,y) 返回两个数中小的那个
6.Math.max(x,y) 返回两个数中大的那个