import java.util.List; import java.util.ArrayList; public class Deck { private List l; //saving the list in an array...using ArrayList public Deck() { l = new ArrayList(); for (int i=0; i 0) { Object o = l.remove(0); //get the first card and rest of the deck initialized to list o if (Math.random() < 0.5d) left.add(o); //if the value is less than half add to left array list else right.add(o); //else add to right arraylist } l = left; l.addAll(right); //add left and right arraylist to original list } //returning empty list l and saving the list in temp list called l public List takeRemainder() { List temp = l; l = new ArrayList(); return temp; } //returns the list with cards removed..specified by the value n.. //will remove n cards from the deck public List takeTop(int n) { ArrayList top = new ArrayList(); for (int i=0; i