/*
* Math工具
* */
public class Test4 {
public static void main(String[] args) {
double a = 12.5;
double b = 3.1415926;
double c = -12.666;
/*
* abs(参数) 将参数中的数取绝对值
* */
double abs = Math.abs(c);
System.out.println(abs);
/*
* ceil(参数) 将参数中的数向上取整
* */
double ceil = Math.ceil(a);
System.out.println(ceil);
/*
* floor(参数) 将参数中的数向下取整
* */
double floor = Math.floor(a);
System.out.println(floor);
/*
* round(参数)将参数中的数四舍五入 【取整】
* */
long round = Math.round(b);
System.out.println(round);
long round2 = Math.round(a);
System.out.println(round2);
}
}