The == operator for references compare whether the reference values are equal--that is, whether
both references refer to the same object, or both are null.
So if a == b is true, then both a and b refer to the same object, and if it's not, they don't.
So now you're wondering why for some Integers it's true and for others it's not. It's the same reason it's sometimes true for Strings and sometimes not. Namely, there is a constant pool.
For Strings the constant pool contains all the
String literals from the source code, plus all Strings on which intern() was called, plus class names and other JVM bookkeping stuff. For Integer (and I think other integral wrapper classes) it contains, by default -128..127, so that whenever those values are used in autoboxing or with the valueOf() method, you'll get the one from the constant pool, rather than creating a new one.