Suppose I have this in C++:
void test(int &i, int &j) { ++i; ++j; }
The values are altered inside the function and then use
Java has no equivalent of C++ references. The only way to get this to work is to encapsulate the values in another class and swap the values within the class.
Here is a lengthy discussion on the issue: http://www.yoda.arachsys.com/java/passing.html