This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
If you're from a C++ background, you may be envisioning something like this:
Alas, you cannot have a method with precisely those semantics in Java. You'll have to use a temporary variable to swap two variables. If you'd like to swap two items in an array, you can just do what comes naturally:
Just to elaborate on what David said: You can't use a swap function with the semantics swap(int a, int b) because ints are passed by value, not by reference. If you want to swap the values of two objects, you can usually do that. You can also use the array as David explained. If you are just using integers, it's less complicated to just do it in the code instead of in a separate function.