[java] Java method to swap primitives