how does compareTo and compare work?
<p>I know that compare and <code>compareTo</code> returns an <code>int</code> value.</p>

<p>For example:</p>

<pre><code>Returns
0 if a equal b
-1 if a &lt; b
+1 if a &gt; b
</code></pre>

<p><code>sort</code> method makes a call to either <code>compareTo</code> or <code>compare()</code> methods. But how does <code>sort</code> method arranges the <code>list</code> when compare or <code>compareTo</code> returns a <code>int</code> value. What is background scenario running after a <code>compare</code> or <code>compareTo</code> returns an int value to sort?how does <code>sort</code> method makes use of int values(<code>-1</code> or <code>0</code> or <code>1</code>) returned to it from <code>compare</code> and <code>compareTo</code></p>
