title: How to swap more than two variables using temporary variables
body: <p>I'm trying to figure out how to swap more than two variables around using a temp variable.  There are 4 variables to be swapped, 1,2,3 and 4.  Variable one is to swap with 2, 2 with 3, 3 with 4 and 4 with 1.  It seems simple enough but I've only learnt how to swap two variables so and am struggling with the larger scale.  I've tried </p>
  
  <pre><code>temp = 1
  1 = 2
  temp = 2 
  2 = 3 
  temp = 3
  3 = 4
  temp = 4
  4 = 1
  </code></pre>
  
  <p>Do i need more than one temp variable?  Still only a beginner any help would be appreciated!</p>
  
  <p>Edit: Sorry, forgot to add I'm coding for java.</p>