title: How to write a swap method that takes an array and two integers
body: <p>I am trying to write a swap method in the form of</p>
  
  <pre><code>swap(T[], int, int)
  </code></pre>
  
  <p>This method should take an array and swap two of the positions in that array. For example, say I have an array named table and two arbitrary integers in that array called up and down. I would like to be able to use the method swap so that:</p>
  
  <pre><code>swap(table, up, down);
  </code></pre>
  
  <p>will swap the values at the position of up and down in the given array of table.
  Could anyone help me out? I know I need to use a temp to store the values but I'm not quite sure what I need to do beyond that.</p>