   import java.util.Random;
   import java.util.Arrays;

/**************************************************************
	Dice represents a collection of Die objects
**************************************************************/
   public class Dice
   {
      Die [] dice;
		Random gen;
   
   /**************************************************************
   	The constructor uses a random generator to build each die.
   	The number of Die objects is passed as a parameter.
   	@param gen The random generator
   	@param num The number of die objects
   **************************************************************/	
      public Dice(Random gen, int num)
      {
			this.gen = gen;
			
         dice = new Die[num];
         for (int ii = 0; ii < dice.length; ii++)
         {
            dice[ii] = new Die(gen);
         }
      }
   /**************************************************************
   	This copy constructor returns an identical set of dice to 
      the parameter. This is used to create a set of dice whose 
      order can be changed from the original.You should use the 
      Die constructor that creates a die with the same face value
      as the original for each of the Die in the set. 
      
   	@param dice The Dice object to copy
   **************************************************************/
      public Dice(Dice dice)
      {
      // make me
      }
   
    /********************************************************
    * getSize returns the number of dice in this set
    *
    * @return The number of dice in the set
    * ******************************************************/
      public int getSize()
      {
         return dice.length;
      }
   
   /**************************************************************
   	roll rolls each of the die objects
   **************************************************************/
      public void roll()
      {
         for (Die d : dice)
         {
            d.roll();
         }
      }
   
   /**************************************************************
   	roll rolls each of the die objects that do not have a hold
   	@param hold An array where the true values are held dice
   **************************************************************/
      public void roll(boolean[] hold)
      {
         for (int ii = 0; ii < dice.length; ii++)
         {
            if (!hold[ii])
               dice[ii].roll();
         }
      }
   
   /**************************************************************
   	toString returns a list of the die face values
   	@return The String of face values
   **************************************************************/
      public String toString()
      {
         String builder;
         builder = "";
      
         for (int ii = 0; ii < dice.length; ii++)
         {
            if(builder.length() > 0)
               builder += ' ';		// single space between 
            builder += dice[ii].getFace();
         }
         return builder;
      }
   /********************************************************
    * setDie - changes the value of a specified die in 
    * the set. Used for testing. If the which parameter 
    * is out of bounds or the value is > 6, no change is made
    *
    * @param which The die to set the value of
    * @param value The new value
    * ******************************************************/
      public void setDie(int which, int value)
      {
         if (which >= 0 && which <= getSize())
            if (value >= Die.LO && value <= Die.HI)
               dice[which].setFace(value);
      }
    /********************************************************
    * getFace - gets the value of the indicated Die object.
    * If the which parameter is out of bounds or the value is > 6
    * -1 is returned
    *
    * @param which The die to get the value of
    * ******************************************************/
      public int getFace(int which)
      {
      	int face = -1;
      	
         if (which >= 0 && which <= getSize())
            face = dice[which].getFace();
         return face;
      }
    /********************************************************
     * sortDice - sorts the Die objects in the dice array
     * into ascending order.
     *******************************************************/
      public void sortDice()
      {
         Arrays.sort(dice);:
      }
   
   }