// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class Special {
    private final static double EPS = 0.000001;
    public static void main(String[] args) {
        test(0.9);
        test(0.99);
        test(0.999);
        test(0.9999);
        test(0.99999);
        test(0.999999);
        test(0.9999999);
        test(0.99999999);
        test(1.1);
        test(1.01);
        test(1.001);
        test(1.0001);
        test(1.00001);
        test(1.000001);
        test(1.0000001);
        test(1.00000001);
    }
    private static void test(double x) {
        System.out.println(x + " " + isReallyInt(x));
        return;
    }
    private static boolean isReallyInt(double x) {
        long near = (int)(x + 0.5);
        if(((x - near) < -EPS) || ((x - near) > EPS))
            return false;
        else
            return true;
    }
}
