title: Java Collections.rotate() with an array doesn't work
body: <p>I have the following Java code:</p>
  
  <pre><code>import java.util.Arrays;
  import java.util.Collections;
  
  public class Test {
      public static void main(String[] args) {
          int[] test = {1,2,3,4,5};
          Collections.rotate(Arrays.asList(test), -1);
          for(int i = 0; i &lt; test.length; i++) { System.out.println(test[i]); }
      }
  
  }
  </code></pre>
  
  <p>I want the array to be rotated, but the output I get is</p>
  
  <pre><code>1
  2
  3
  4
  5
  </code></pre>
  
  <p>Why is this?</p>
  
  <p>And is there an alternative solution?</p>
  
  <p>EDIT:</p>
  
  <p>So this works:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Collections;
  import java.util.List;
  
  public class Test {
      public static void main(String[] args) {
          int[] test = {1,2,3,4,5};
          List&lt;Integer&gt; testList = new ArrayList&lt;Integer&gt;();
          for(int i = 0; i &lt; test.length; i++) { testList.add(test[i]); }
          Collections.rotate(testList, -1);
          for(int i = 0; i &lt; test.length; i++) { System.out.println(testList.get(i)); }
      }
  
  }
  </code></pre>
  
  <p>But Arrays.asList is supposed to return a list that when written to, copies the changes to the array. Is there any way to fix this without manually doing the conversion from array to list?</p>
  
  <p>I (think that I) can't afford to waste that much CPU time and memory to do the conversion.</p>