private static void carry(int[] ca, int index) { if (ca[index] == (CHARS.length() - 1)) { ca[index] = 0; carry(ca, --index); } else { ca[index] = ca[index] + 1; } }
/** * Get a unique string * * @return the unique string */ private static String getUniqueString() { char[] buf = new char[NUM_CHARS]; carry(lastString, buf.length - 1); for (int i = 0; i < buf.length; i++) { buf[i] = CHARS.charAt(lastString[i]); } return new String(buf); }