How two swap two elements in a array list without using collections.swap method
<p>Develop a method to swap two elements with specified valid indexes I and j:      </p>

<pre><code>public void swap(int I, int j);
</code></pre>

<p>This is the method I have to use to swap two of the elements in an array list. 
<em>The original list is: [a ==> b ==> c ==> d............] After calling swap(0, 2): [c ==> b ==> a ==> d............]</em>
This is what should print out for the output.</p>

<p>--------- First class-----</p>

<pre><code>package it179.pa2;

import java.util.*;

public class MyArrayList {

private String list;


MyArrayList(String list) {
    this.list = list;
}
MyArrayList() {

}

public void swap(int i, int j) {
    int temp1;
    temp1 = i;
    i = j;
    j = temp1;               
    }

@Override
public String toString() {
    return list + "==&gt;";
}
</code></pre>

<p>}</p>

<p>----- Second Class-----</p>

<pre><code>package it179.pa2;
import java.util.*;

public class MyArrayListTest {


public static final void main (String[]args) {

    MyArrayList my = new MyArrayList();


    ArrayList&lt;MyArrayList&gt; al = new ArrayList&lt;MyArrayList&gt;();

    al.add(new MyArrayList("A"));
    al.add(new MyArrayList("B"));
    al.add(new MyArrayList("C"));
    al.add(new MyArrayList("D"));
    al.add(new MyArrayList("E"));
    al.add(new MyArrayList("F"));
    System.out.print("The original list is: ");
            for (MyArrayList tmp: al) {

        System.out.print(tmp);      
    }// end of for

    System.out.println("After calling swap(0,2): ");
    System.out.print(al);
}
</code></pre>

<p>}</p>