## Math类
1,概述:Math包含执行基本数字运算的方法
因为Math类的成员是static修饰的,可以通过类名就可以直接使用。
方法使用 | 作用 |
---|---|
Math.abs(int a) | 返回参数的绝对值 |
Math.round(double a) | 按照四首五入返回最参数的int |
– | – |
Math.max(int a,int b) | 返回两个int 的最大值 |
Math.min(int a,int b) | 返回两个int 的最小值 |
– | – |
Math.pow(double a,double b) | 返回a的b次幂 |
Math.random() | 返回值为double的正值,[0.0,1.0) |