I have a program that brute force searches for a combination of inputted array elements by the user and when the program is searching all the for loops are nested for the brute search then I have this test() which looks is responsible for testing out all the possible combinations of the nested for loop to find the the combination entered by the user of the program, how ever the code is super redundant, here is a sample.
public static boolean test(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k){
boolean result1 = true;
if(a == 0){
cube = turn_U(cube);
}
else if(a == 1){
cube = turn_Ui(cube);
}
else if(a == 2){
cube = turn_U2(cube);
}
else if(a == 3){
cube = turn_L(cube);
}
else if(a == 4){
cube = turn_Li(cube);
}
else if(a == 5){
cube = turn_L2(cube);
}
else if(a == 6){
cube = turn_F(cube);
}
else if(a == 7){
cube = turn_Fi(cube);
}
else if(a == 8){
cube = turn_F2(cube);
}
else if(a == 9){
cube = turn_R(cube);
}
else if(a == 10){
cube = turn_Ri(cube);
}
else if(a == 11){
cube = turn_R2(cube);
}
else if(a == 12){
cube = turn_B(cube);
}
else if(a == 13){
cube = turn_Bi(cube);
}
else if(a == 14){
cube = turn_B2(cube);
}
else if(a == 15){
cube = turn_D(cube);
}
else if(a == 16){
cube = turn_Di(cube);
}
else if(a == 17){
cube = turn_D2(cube);
}
This is what happens for letters a through k and I was wondering how I could shorten this, I had an idea where I could make a method that selects a turn method based on the letter in the test() , this would reduce so that test has 11 calls to the method instead of the all of this repeated ones.