Math常用类
package www.xz.math_;
public class MathMethods {
public static void main(String[] args) {
int abs = Math.abs(-9);
System.out.println(abs);
double pow = Math.pow(2, 4);
System.out.println(pow);
double ceil = Math.ceil(-3.0001);
System.out.println(ceil);
double floor = Math.floor(-4.999);
System.out.println(floor);
long round = Math.round(-5.001);
System.out.println(round);
double a = 2;
double b = 7;
for (int i = 0; i < 10; i++) {
System.out.println((int) (2 + (Math.random() * 6)));
}
int min = Math.min(1, 9);
int max = Math.max(45, 90);
System.out.println("min=" + min);
System.out.println("max=" + max);
}
}