Peer-reviewed code snippets that anyone can edit
A wiki for useful code snippets
An alphabet sequence generator
public class SeqGen {
    public static void main(String[] args) {
        // This is the configurable param
        int seqWidth = 3;
 
        int charSetSize = 26;
 
        // The size of the array will be 26 ^ seqWidth. ie: if 2 chars wide, 26
        // * 26. 3 chars, 26 * 26 * 26
        int total = (int)Math.pow(charSetSize, seqWidth);
 
        StringBuilder[] sbArr = new StringBuilder[total];
        // Initializing the Array
        for (int j = 0; j <total; j++) {
            sbArr[j] = new StringBuilder();
        }
 
        char ch = 'A';
        // Iterating over the entire length for the 'char width' number of times.
        // TODO: Can these iterations be reduced?
        for (int k = seqWidth; k > 0; k--) {
            // Iterating and adding each char to the entire array.        
            for (int l = 0; l < total; l++) {
                sbArr[l].append(ch);
                if (l % Math.pow(charSetSize, k-1) == 0) {
                    ch++;
                    if (ch > 'Z') {
                        ch = 'A';
                    }
                }
            }
        }
 
        // Use the stringbuilder array.
        for (StringBuilder builder : sbArr) {
            System.out.println(builder.toString());
        }
    }
}