I really can\'get my head around why the following happens:
Double d = 0.0; System.out.println(d == 0); // is true System.out.println(d.equals(0)); // is false ?
Number objects only equal to numbers with the same value if they are of the same type. That is:
Number
new Double(0).equals(new Integer(0)); new BigInteger("0").equals(new BigDecimal("0"));
and similar combinations are all false.
In your case, the literal 0 is boxed into an Integer object.
0
Integer