1、小数取整
public class Test{
public static void main(String args[]){
double d = 100.675;
float f = -90;
System.out.println(Math.ceil(d));
System.out.println(Math.ceil(f));
System.out.println(Math.floor(d));
System.out.println(Math.floor(f));
}
}
// 输出
101.0
-90.0
100.0
-90.0
Math.ceil 向上取整
Math.floor 向下取整