In Java, all variables containing proper objects are actually references (i.e. pointers). Therefore, method calls with these objects as arguments are always \"by reference\"
You're wrong in that you should pass by pointer. If you want to pass by reference, well... simply pass by reference:
void foo(int& x)
{
x = 3;
}
int main()
{
int a = 0;
foo(a);
assert( a == 3 );
}
Also, note that passing by value guarantees that the your variable can't be changed inside the called context. Although so would passing by const reference...