Recently i was there in a situation where in i needed to swap the values rather using the traditional way.
Following is the small java program which will give you the idea:
If you don’t like bitwise operations u can use following program
Feel free to comment if you have any doubts and share if like. 🙂