title: How to shuffle an ArrayList
body: <p>I need some help in writing a method that will shuffle the ArrayList. I can't figure out what to place in my method. Here is what I have so far. I tried using the random method to randomize the integers in the list but that didn't work. Can someone show me how to do this?</p>
  
  <p>Here is the code I've tried:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Scanner;
  
  public class Lab 11 {
    public static void main(String[] args) {
      ArrayList&lt;Double&gt; list = new ArrayList&lt;Double&gt;();
  
      Scanner input = new Scanner(System.in);   
      System.out.print("Enter integers (input ends with 0): ");
       double value;
  
      do {
        value = input.nextDouble(); // Read a value from the input
  
        if (value != 0) 
          list.add(value); // Add the value if it is not in the list
      } while (value != 0);
       System.out.println("The maximum number is " + max(list));
  
       System.out.print("Enter five double values: ");
       for (int i = 0; i &lt; 5; i++)
        list.add(input.nextDouble());
  
      System.out.println("The sum is " + sum(list));
  
    }
  
    public static Double max(ArrayList&lt;Double&gt; list) {
      if (list == null || list.size() == 0)
        return null;
  
      double result = list.get(0);
      for (int i = 1; i &lt; list.size(); i++)
        if (result &lt; list.get(i))
          result = list.get(i);
  
      return result;
    }
  
    public static double sum(ArrayList&lt;Double&gt; list) {
      double sum = 0;
      for (int i = 0; i &lt; list.size(); i++)
        sum += list.get(i);
      return sum;
    }
  }
  </code></pre>