   import java.util.ArrayList;
    public class TestArrayList2
   {
       public static void main (String [] args)
      { 
      
         // declare a specific type of ArrayList
         ArrayList <Double>  myArrayList;
      
      	// declare an Array of Double
         Double [] myDoubles;
      
         // instantiate the ArrayList
         myArrayList = new ArrayList <Double> ();
      
        
        // add some values to the ArrayList
         myArrayList.add (3.68);
         myArrayList.add (29.783);
         myArrayList.add (0.3571);
         myArrayList.add (0.1);
      
          // determine the number of elements in ArrayList
         System.out.println 
         (" # elements in myArrayList is : "+myArrayList.size());
      
         // print the values
         for (int i = 0; i < myArrayList.size(); i++) //prints 1 per line
         {
            System.out.println (myArrayList.get(i));   
         }
      
            // convert the ArrayList to an Array
         myDoubles = myArrayList.toArray(new Double [350]);
         
      	    // print out the first 7 elements in the array
      	for (int i = 0; i < 7; i++)
      	{
      	  System.out.println (myDoubles[i]);
         }
         // determine the length of the Array
         System.out.println 
         ("the # elements in the Arrray is " + myDoubles.length);
      
      
      }
   }