title: put random number in the array list java
body: <p>I'm trying to put all random number which I generated to the arraylist and print all the random number into single array</p>
  
  <pre><code>    static int pick;
      public static void main(String[] args) {
          ArrayList al = new ArrayList(); 
          Random rand = new Random();
  
          for (int j = 0; j&lt;10; j++)
          {
          pick = rand.nextInt(100);
          al.add(pick);
          System.out.println("Contents of al: " + al);
          }
  </code></pre>
  
  <p>from the above function I got the result like this</p>
  
  <pre><code> Contents of al: [43]
   Contents of al: [43, 44]
   Contents of al: [43, 44, 3]
   Contents of al: [43, 44, 3, 66]
   Contents of al: [43, 44, 3, 66, 47]
   Contents of al: [43, 44, 3, 66, 47, 24]
   Contents of al: [43, 44, 3, 66, 47, 24, 12]
   Contents of al: [43, 44, 3, 66, 47, 24, 12, 35]
   Contents of al: [43, 44, 3, 66, 47, 24, 12, 35, 0]
   Contents of al: [43, 44, 3, 66, 47, 24, 12, 35, 0, 85]
  </code></pre>
  
  <p>the expected output I want is just the last line of the above result</p>
  
  <pre><code> Contents of al: [43, 44, 3, 66, 47, 24, 12, 35, 0, 85]
  </code></pre>
  
  <p>anyone know how to do it?</p>