In java changing the argument of a method to refer to some other object does not have any effect on the original argument.
Therefor a does not point to tmp after the execution of mystery
.
To accomplish the swapping your mystery
method needs to work on arr
directly