So how exactly would I go about changing the global reference rather than creating a new local reference?
I see where the break is...
It seemed to me that when I say
changeInteger( wrapperI );
that I'm passing a pointer to an Integer object into the method and inside the method, the parameter i is pointing to the same thing as global variable wrapperI. So when I changed i inside of the method it should also change wrapperI.
BUT, when I said i = new Integer( 100 ), i no longer pointed to what wrapperI pointed to. And I'm assuming ( by looking at the API ) that Integer is immutable, therefore there is no way to change its value without creating a new instance of Integer and assigning to the previous Integer object reference. So it is impossible to change an integer( of any kind) by passing it into a method. You HAVE to assign it in its original scope.
Tell me if I'm wrong.
Rather use your own wrapper with your own write accessor (setInt(int i)).
Autoboxing does not ease these things. When you do i = 100, it is like doing i = new Integer(100); because i is an Integer whereas 100 is an int.
Anyway your way of doing was not right, you should have looked for a modifier in the API to change the enclosed int in the Integer instance. As Integer is immutable, there is no such modifier and you should create your own class.