public static boolean doubleEquals(double a, double b)
    {
        // the first check ensures +0 == -0 is true. the second ensures that NaN == NaN is true
        // for all other cases a == b and doubleToLongBits(a) == doubleToLongBits(b) will return
        // the same result
        // doubleToLongBits converts all NaNs to the same representation
        return a == b || doubleToLongBits(a) == doubleToLongBits(b);
    }
@Test
    public void testDoubleEquals()
    {
        assertTrue(doubleEquals(0, Double.parseDouble("-0")));
        //0x7ff8123412341234L is a different representation of NaN
        assertTrue(doubleEquals(Double.NaN, longBitsToDouble(0x7ff8123412341234L)));
    }