title: Java sort based on two columns
body: <p>Lets say I have table like this:</p>
  <pre><code> String | Int1 | Int2
   &quot;foo&quot;    5      0
   &quot;faa&quot;    4      1
   &quot;zaa&quot;    0      1
   &quot;zoo&quot;    4      2
   &quot;laa&quot;    4      3
   &quot;loo&quot;    1      4
  </code></pre>
  <p>What I would like to get is table like this:</p>
  <pre><code> String | Int1 | Int2
   &quot;foo&quot;    5      0
   &quot;laa&quot;    4      3
   &quot;zoo&quot;    4      2
   &quot;faa&quot;    4      1
   &quot;loo&quot;    1      4
   &quot;zaa&quot;    0      1
  </code></pre>
  <p>First thing that happens is sort based on column <code>Int1</code>.</p>
  <p>Second thing that happens is sort of based on column <code>Int2</code> but only on rows that have same numbers in column <code>Int1</code></p>
  <h3>How should I approach this problem without using any database engine?</h3>