Why typecast is not working in this case ?
int b[] = {1,2,3,4,5};
ArrayList list = new ArrayList();
for (int i = 0; i < b.length; i++) {
list.add(i);
}
Collections.sort(list);
int c = (int) list.get(0); // This line is giving error
How to resolve this error??
Try like this