I need to generate a list of all possible combinations of colors(I have 8 different colors) and would like to specify the length
of the output, without going into the code and adding another loop.
for (int s1 = 0; s1 < kinds.length; s1++) {
for (int s2 = 0; s2 < kinds.length; s2++) {
for (int s3 = 0; s3 < kinds.length; s3++) {
for (int s4 = 0; s4 < kinds.length; s4++) {
for (int s5 = 0; s5 < kinds.length; s5++) {
String[] guess = new String[length];
guess[0] = colors[s1];
guess[1] = colors[s2];
guess[2] = colors[s3];
guess[3] = colors[s4];
guess[4] = colors[s5];
Possible.add(guess);
}
}
}
}
}