How to find the sum of combination on given integer array.
int[] a = { 0, 1, 2, 3, 4, 5, 6, 7, 12, 15, 18, 20, 24, 25, 27, 28 };
int sum = 0;
String test = "";
int tmp = 0;
System.out.println(a.length);
for (int j = 0; j <= a.length - 1; j++) {
sum = sum + a[j];
test = test + a[j] + ",";
if (sum == valueToFind) {
System.out.println("[" + test.substring(0, test.length() - 1)
+ "]");
j = tmp;
sum = 0;
test = "";
tmp++;
}
if (sum > valueToFind) {
j = tmp;
sum = 0;
test = "";
tmp++;
}
}