title: find all possible combination of a value in an int array
body: <p>I have a array list with sorted increasing numbers.
  I have a target value and I must find all the possible combination of the target value within my array. So if I have array = [1,1,3,5,6,7] and my target value is 8 then the program hould should calculate this: </p>
  
  <pre><code>1+1+6 =8
  1+7 = 8
  1+7 = 8
  3 + 5 = 8,
  </code></pre>
  
  <p>it should return 4.</p>
  
  <p>here is my implementation for this:</p>
  
  <pre><code>public static int numberOfConnections(int[] e, int b){
          int result = 0;
          int temp = 0;
          for(int i = 0; i &lt; e.length; i++){
              for(int j = 0; j &lt; e.length; j++){
                  temp += e[j];
                  if(temp &gt; b){
                      temp = 0;
                  }
                  else if( temp == b){
                      result++;
                      temp = 0;
                  }
                  else if(temp &lt; b &amp;&amp; i == edges.size()){
                      result++;
                  }
              }
          }
          return result;
      }
  </code></pre>
  
  <p>what am I doing wrong ?? I am getting wrong results.</p>