title: Iterate through array, sum and put results in new array
body: <p>I have an arrayList filled with integers and I need to iterate through this arrayList, add the numbers up until a threshold is reached, then put the resulting sum into a second arrayList slot, and move back to where I left off in the original arrayList, keep iterating and summing until the threshold is reached and then put that in the second slot, and so on until all 40 original items have been summed and put into a smaller arrayList.</p>
  
  <p>I've thought of using two nested loops but I can't get the two loops to work together.</p>
  
  <p>I'm very new to Java and don't know how to do this. Any suggestions will be helpful.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>int threshold = 12;
  int sumNum = 0;
  int j = 0;
  int arr1[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
  for (int i = 0; i &lt; arr1.length; i++) {
    while (sumNum &lt;= threshold) {
    sumNum += arr[j];
    j++
  }//end while
  
  }//end for
  </code></pre>