private static void createGridResource(String name, int totalMachine,
                              int totalPE, double bandwidth, int[] peRating,
                              int policy, double cost)
    {
        // Here are the steps needed to create a Grid resource:
        // 1. We need to create an object of MachineList to store one or more
        //    Machines
        MachineList mList = new MachineList();

        int rating = 0;
        for (int i = 0; i < totalMachine; i++)
        {
            // even Machines have different PE rating compare to odd ones
            if (i % 2 == 0) {
                rating = peRating[0];
            }
            else {
                rating = peRating[1];
            }

            // 2. Create one Machine with its id, number of PEs and rating
            mList.add( new Machine(i, totalPE, rating) );
        }

        // 3. Create a ResourceCharacteristics object that stores the
        //    properties of a Grid resource: architecture, OS, list of
        //    Machines, allocation policy: time- or space-shared, time zone
        //    and its price (G$/PE time unit).
        String arch = "Sun Ultra";      // system architecture
        String os = "Solaris";          // operating system
        double time_zone = 0.0;         // time zone this resource located

        ResourceCharacteristics resConfig = new ResourceCharacteristics(
                arch, os, mList, policy, time_zone, cost);

        // 4. Finally, we need to create a GridResource object.
        long seed = 11L*13*17*19*23+1;
        double peakLoad = 0.0;       // the resource load during peak hour
        double offPeakLoad = 0.0;    // the resource load during off-peak hr
        double holidayLoad = 0.0;    // the resource load during holiday

        // incorporates weekends so the grid resource is on 7 days a week
        LinkedList Weekends = new LinkedList();
        Weekends.add(new Integer(Calendar.SATURDAY));
        Weekends.add(new Integer(Calendar.SUNDAY));

        // incorporates holidays. However, no holidays are set in this example
        LinkedList Holidays = new LinkedList();
        try
        {
            GridResource gridRes = new GridResource(name, bandwidth, seed,
                resConfig, peakLoad, offPeakLoad, holidayLoad, Weekends,
                Holidays);
        }
        catch (Exception e)
        {
            System.out.println("Error in creating GridResource.");
            System.out.println( e.getMessage() );
        }

        System.out.println("Creates one Grid resource with name = " + name);
        return;
    }