title: I'm trying to get combinations but I don't know how to do it
body: <p>In a test case, I have 1 2 3 4 as the inputs, I want to get</p>
  <p>{1+2, 3+4}</p>
  <p>{1+3, 2+4}</p>
  <p>{1+4, 2+3}</p>
  <p>but I only can do {1+2, 3+4} I can't think of any ways to get {1+3, 2+4}.
  I need some algorithm advice, can't think of any conditions to do this.</p>
  <pre><code>for (int j=0; j&lt;woodLength.length; j++) {
          if (woodLength[j][2] != 1) {
              // a function that can create the boards using the wood pieces
              for (int i=0; i&lt;woodLength.length; i++) {
                  // set used boards as 1 and unused as 0
                  if (woodLength[i][1] != 1) {
                      woodenBoardHeight.add(woodLength[i][0]+woodLength[i+1][0]);
                      System.out.println(woodenBoardHeight.get(wBHCount));
                      wBHCount ++;
                      woodLength[i][1] = 1;
                      woodLength[i+1][1] = 1;
                  }
              }
              for (int i=0; i&lt;woodLength.length; i++) {
                  woodLength[i][1] = 0;
              }
              woodLength[j][2] = 1;
              woodLength[j+1][2] = 1;
          }
      }
  </code></pre>
  <p>this is my code, right now this prints {3,7} but I also want {4,6} and {5,5}</p>
  <p>If it's helpful, I'm trying to solve CCC 2017 Senior S3 question</p>
  <p><a href="https://www.cemc.uwaterloo.ca/contests/computing/2017/stage%201/seniorEF.pdf" rel="nofollow noreferrer">https://www.cemc.uwaterloo.ca/contests/computing/2017/stage%201/seniorEF.pdf</a></p>