Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int getAllSums(int array[], int startingValue, int pos, int target){
- int random = 0;
- int sum1 = random;
- for (int i = pos; i < array.length; i++)
- {
- int currentValue = startingValue + array[i];
- if(currentValue%target == 0) {
- array[i] = 0;
- sum1 = random + currentValue;
- return sum1;
- }else {
- getAllSums(array, currentValue, i + 1, target);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement