i have tried running and debugging the following code in IntellIj in order to track what each line of my code does but i still dont understand the result.

```java
public static void testMyFun() {  

  List<Integer> xs = new ArrayList<Integer>(); 

  for (int i = 0; i < 5; i++) 
    xs.add(i);  

  myFun(xs,2);

  System.out.println(xs);  
}   

public static <A> void myFun (List<A> xs, int n) {  
  if (n > 0) {   

    A x = xs.get(0);  

    xs.remove(0); 

    xs.add(x); 

    myFun(xs, n-1);    
} 

```

The result that i get is [ 2,3,4,0,1] 
How does 0 and 1 go to the end of the list?