This is one of the AlternativesToPassByReference.
If your function is modifying its parameter, return the modified parameter instead:
int addOne (int i) { return i + 1; } ... int i = 2; i = addOne (i); System.out.println (i); 3