You can't.
Java doesn't have pass-by-reference. It's not possible to write this sort of swap() method in Java, period.
Now, most of the time you want swap() in Java, you want to swap two elements in an array, and that's doable: you pass the array and the two indices as arguments to swap().