title: Storing arrays generated by a recursive method
body: <p>How can I save all the arrays generated by the following method?</p>
  
  <pre><code>static void permute(java.util.List&lt;Character&gt; arr, int k) {
      for (int i = k; i &lt; arr.size(); i++) {
          java.util.Collections.swap(arr, i, k);
          permute(arr, k + 1);
          java.util.Collections.swap(arr, k, i);
      }
      if (k == arr.size() - 1) {
          System.out.println(java.util.Arrays.toString(arr.toArray()));
      }
  }
  </code></pre>