working

Converting an ArrayList to array:

1. Create an array with same size as the arraylist
2. pass that array as input of S.toArray(num);

An array can  be easily sorted;

Array.sort(num)