1、Double test=100.00,此时返回true
public static void main(String[] args) {
Double test = 100.00;
double eps = 1e-10;
boolean isInteger = test - Math.floor(test) < eps;
System.out.println(isInteger);
}
2、Double test = 100.01,此时返回false
public static void main(String[] args) {
Double test = 100.01;
double eps = 1e-10;
boolean isInteger = test - Math.floor(test) < eps;
System.out.println(isInteger);
}
当返回为true时,说明数字的小数点后都是为0的;当为false时,说明数字的小数点后是有大于0的数字