So I'm using the classic algorithm for permutations which is
private static void permutation(String prefix, String str) { int n = str.length(); if (n == 0) System.out.println(prefix); else { for (int i = 0; i < n; i++) permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n)); } } The only thing I can't figure out how to do is how to store the permutations into an array instead of just printing them out. Any help is appreciated.