kzaemrio
2017-07-11 11:46:12 +08:00
private static int count(int[] array) {
return count1(array, array.length, 0, 0);
}
private static int count1(int[] array, int length, int count, int i0) {
if (i0 == length) {
return count;
}
count = count2(array, length, count, i0, i0 + 1);
return count1(array, length, count, i0 + 1);
}
private static int count2(int[] array, int length, int count, int i0, int i1) {
if (i1 == length) {
return count;
}
count = count3(array, length, count, i0, i1, i1 + 1);
return count2(array, length, count, i0, i1 + 1);
}
private static int count3(int[] array, int length, int count, int i0, int i1, int i2) {
if (i2 == length) {
return count;
}
count = count4(array, length, count, i0, i1, i2, i2 + 1);
return count3(array, length, count, i0, i1, i2 + 1);
}
private static int count4(int[] array, int length, int count, int i0, int i1, int i2, int i3) {
if (i3 == length) {
return count;
}
count = count5(array, length, count, i0, i1, i2, i3, i3 + 1);
return count4(array, length, count, i0, i1, i2, i3 + 1);
}
private static int count5(int[] array, int length, int count, int i0, int i1, int i2, int i3, int i4) {
if (i4 == length) {
return count;
}
System.out.println(String.format(
"%d %d %d %d %d",
array[i0],
array[i1],
array[i2],
array[i3],
array[i4]
));
return count5(array, length, count + 1, i0, i1, i2, i3, i4 + 1);
}