title: Return all possible sums that can be formed by using numbers in array JAVA
body: <p>For some reason I am getting the right answers, but they are being duplicated, and I am not sure why. Any ideas?</p>
  
  <p>Here's my code so far:</p>
  
  <pre><code>import java.util.ArrayList;
  
  public class Problem2 
  {
  
  public static void getSum(int[] numbersArray, int starting, int sum)
  {
      if(numbersArray.length == starting)
      {   
          return;
      }
      int value = sum + numbersArray[starting];
  
      getSum(numbersArray, starting + 1, value);
      getSum(numbersArray, starting + 1, sum);
  
      System.out.print(sum + " " + value + " ");
  }
  
  public static void main(String[] args)
  {
      getSum(new int[] {3, 5}, 0, 0);
  }
  }
  </code></pre>