I am writing a combination program for class
System.out.println(Arrays.toString(cList));
finish = Arrays.copyOfRange(cList, r-n, r);
System.out.println(Arrays.toString(finish));
tmp = Arrays.copyOfRange(cList, 0, n);
System.out.println(Arrays.toString(tmp));
int cFact = factorial(n)/(factorial(r)*factorial(n-r));
for (int k = 2; k < cFact; k++){
int m = r;
int max = n;
if (tmp[m].compareTo(finish[max]) == 0) {
m = m - 1;
max = max - 1;
System.out.println(Arrays.toString(tmp));
}//end if
else {
String temp = tmp[m];
tmp[m] = finish[max];
finish[max] = temp;
System.out.println(Arrays.toString(tmp));
}// end else
}//end cFact for
The issue I am having is that in my program the first three println statements are printing normally, however I am unable to print anything inside the for loop or if/else statement.
Any suggestions would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire