Number & Math 类方法
下面的列出的是 Number & Math 类常用的一些方法:
- xxxValue()
- 将 Number 对象转换为xxx数据类型的值并返回。
- compareTo()
- 可以是一个 Byte, Double, Integer, Float, Long 或 Short 类型的参数. 相等返回0, 小于返回-1, 大于范围1.
- 将number对象与参数比较。
- equals()
- valueOf()
- toString()
- parseInt()
- abs()
- ceil()
- 返回大于等于( >= )给定参数的的最小整数,类型为双精度浮点型。
- floor()
- rint()
- round()
- 它表示四舍五入,算法为 Math.floor(x+0.5),即将原来的数字加上 0.5 后再向下取整,所以,Math.round(11.5) 的结果为12,Math.round(-11.5) 的结果为-11。
- min()
- max()
- exp()
- log()
- pow()
- sqrt()
- sin()
- cos()
- tan()
- asin()
- acos()
- atan()
- atan2()
- toDegrees()
- toRadians()
- random()
* Math.random()
原文地址:https://www.cnblogs.com/Twittery/p/14411762.html