java.Math

math:e,PI
没有构造方法
方法:
double math.abc(a); 计算绝对值
double math.cbrt(a);计算立方根
double math.sqrt(a);计算平方根
double math.pow(x,y);计算x^y
double math.hypot(x,y);计算sqrt(x^2+y^2)
double math.ceil(a);例:a=4.1,return 5;返回大于a的最小整数
double math.floor(a);例:a=4.1,return 4;返回小于a的最大整数
long math.round(double a);小数按四舍五入转换成整数
int math.flaot(float a);小数按四舍五入转换成整数
double math.exp(x);返回e的x次方
double math.expm1(x);返回 e^x -1
double math.log(a);计算log(a)以e为底。
double math.log10(a);计算 ln(a)以10为底
double math.max(x,y);最大值
double math.min(x,y);最小值
double math.random();获取0.0到1.0之间随机数

test:
获取1-10之间随机数,放到【8】数组中,保证数据不重复
获取20-70之间随机数int t =(int)(math.random()*50+20);

posted @ 2017-07-19 17:38  爵灬色  阅读(122)  评论(0编辑  收藏  举报