public static void main(String[] args) {
double pi = Math.PI;
System.out.println(pi);
double pow = Math.pow(3, 4);
double sqrt = Math.sqrt(16);
int abs = Math.abs(-12);
// 0-1 0=<x<1 随机值
double random = Math.random();
// 向上取最小整数
double ceil = Math.ceil(4.3);
// 向下取整
double floor = Math.floor(4.3);
// 四舍五入值
long round = Math.round(4.6);
double max = Math.max(2.3, 4.5);
int min = Math.min(10, 2);
System.out.println("pow : " + pow);
System.out.println("sqrt : " + sqrt);
System.out.println("abs绝对值 : " + abs);
System.out.println("ceil : " + ceil);
System.out.println("floor : " + floor);
System.out.println("round : " + round);
System.out.println("max : " + max);
System.out.println("min : " + min);
}
Math
最新推荐文章于 2023-09-21 23:59:14 发布