You appear to have arrived in the wrong forum, but don't worry; I can move your question.
Have a look at the documentation for the Integer#valueOf method, and the JLS (=Java® Language Specification) about boxing conversions. Look particularly at what it says about values ≥ −128 and ≤ 127. That should give you a hint why you are getting strange results from the == operator. Another reason not to use ==.
If you can't work out the problem from those resources, tell us, and we shall drop some more hints.
Poop goes in a willow feeder. Wipe with this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java