title: How to concatenate the columns in an two dimensional array?
body: <p>How to concatenate the columns in an two dimensional array ?</p>
  
  <pre><code>a b c d
  1 3 9 6
  4 2 7 1
  </code></pre>
  
  <p>Check the count of columns automatically.</p>
  
  <p>For example:</p>
  
  <p>If four columns are there then it should consider three combination.</p>
  
  <p>Output should be:</p>
  
  <p>First take two combination:</p>
  
  <pre><code>ab ac ad bc bd cd
  13 19 16 39 36 96
  42 47 41 27 21 71
  </code></pre>
  
  <p>Then take three combination:</p>
  
  <pre><code>abc abd bcd acd
  139 136 396 196
  427 421 271 471
  </code></pre>
  
  <p>How should I code this?</p>
  
  <p>Below is the code I tried to get the two combinations. How do I need to change it to get the above output?</p>
  
  <pre><code>for (int i = 0; i &lt; row.size(); i++) {
      for (int j = 0; j &lt; col.size(); j++) {
          for (int k = j + 1; k &lt; col.size(); k++) {
              array1.add(col[j]);
              array2.add(col[k]);
              array.add(array1.get(j) + array2.get(k));
          }
      }
      System.out.println("array");
  }
  </code></pre>