title: Sorting in java using value pair
body: <p>How can I sort this <em>value/pair</em> in <em>Java</em>:</p>
  
  <pre><code>(1,2) (4,2) (2,3)
  </code></pre>
  
  <p>To give me the following? </p>
  
  <pre><code>(4,2) (2,3) (1,2)
  </code></pre>
  
  <p>I cannot understand how <code>compareto()</code> works. Is there anything equivalent to this code in <em>Java</em>? </p>
  
  <pre><code>v.push_back(make_pair(1,2));
  </code></pre>