Why type cast is not working here
<p>Why typecast is not working in this case ?</p>

<pre><code>int b[] = {1,2,3,4,5};
    ArrayList list = new ArrayList();
    for (int i = 0; i &lt; b.length; i++) {
    list.add(i);
    }
        Collections.sort(list);
    int c = (int) list.get(0); // This line is giving error 
</code></pre>

<p>How to resolve this error??</p>
