import java.util.ArrayList;
publicclass Main {
publicstaticvoid main(String[] args) {
ArrayList<Integer> al = new ArrayList<Integer>();
al.add(newInteger(1));
al.add(newInteger(2));
al.add(newInteger(3));
al.add(newInteger(4));
al.add(newInteger(5));
System.out.println("contents of al : " + al);
Object ia[] = al.toArray(); // get array
int sum = 0;
for (int i = 0; i < ia.length; i++){
sum += ((Integer) ia[i]).intValue();
}
System.out.println("Sum is :" + sum);
}
}