title: How do I use an equivalent to C++ reference parameters in Java?
body: <p>Suppose I have this in C++:</p>
  
  <pre><code>void test(int &amp;i, int &amp;j)
  {
      ++i;
      ++j;
  }
  </code></pre>
  
  <p>The values are altered inside the function and then used outside. How could I write a code that does the same in Java? I imagine I could return a class that encapsulates both values, but that seems really cumbersome.</p>