Line 10: The add method checks and increases the storage for the ArrayList if necessary.
The new value is added to the end of the ArrayList.
1 public static void init(ArrayList<Integer> a) 2 { 3 Random r = new Random(); 4 Scanner in = new Scanner(System.in); 5 6 System.out.print("How many random integers: "); 7 int n = in.nextInt(); 8 9 for(int i = 0; i < n; i++) { 10 a.add(r.nextInt(101)); 11 } 12 }