利用该值与最接近整数之差来判断,优雅的写法 public static boolean isInt(double num) { return Math.abs(num - Math.round(num)) < Double.MIN_VALUE; }