public static void main(String[] args)
    {
        System.out.println("Starting Test Cases");
        try
        {
            // Parse the command line args
            int policy = 0;
            if ( args[0].equals("t") || args[0].equals("time") ) {
                policy = ResourceCharacteristics.TIME_SHARED;
            }
            else if ( args[0].equals("s") || args[0].equals("space") ) {
                policy = ResourceCharacteristics.SPACE_SHARED;
            }
            else {
                System.out.println("Error -- Invalid allocation policy....");
                return;
            }

            // determine which test case number to choose
            int testNum = Integer.parseInt(args[1]);
            if (testNum < MIN || testNum > MAX) {
                testNum = MIN;
            }

            ////////////////////////////////////////
            // First step: Initialize the GridSim package. It should be called
            // before creating any entities. We can't run this example without
            // initializing GridSim first. We will get run-time exception
            // error.
            Calendar calendar = Calendar.getInstance();
            boolean trace_flag = false;  // true means tracing GridSim events

            // list of files or processing names to be excluded from any
            // statistical measures
            String[] exclude_from_file = { "" };
            String[] exclude_from_processing = { "" };

            // the name of a report file to be written. We don't want to write
            // anything here.
            String report_name = null;

            // initialize all revelant variables
            double baudRate[] = {1000, 5000}; // bandwidth for even, odd
            int peRating[] = {10, 50};   // PE Rating for even, odd
            double price[] = {3.0, 5.0};   // resource for even, odd
            int gridletLength[] = {1000, 2000, 3000, 4000, 5000};

            // Initialize the GridSim package
            int totalUser = 2;    // total Users for this experiment
            GridSim.init(totalUser, calendar, trace_flag, exclude_from_file,
                    exclude_from_processing, report_name);

            //////////////////////////////////////
            // Second step: Creates one or more GridResource objects
            int totalResource = 3;  // total GridResources for this experiment
            int totalMachine = 1;   // total Machines for each GridResource
            int totalPE = 3;        // total PEs for each Machine
            createResource(totalResource, totalMachine, totalPE, baudRate,
                           peRating, price, policy);

            /////////////////////////////////////
            // Third step: Creates grid users
            int totalGridlet = 4;     // total Gridlets for each User
            createUser(totalUser, totalGridlet, gridletLength, baudRate,
                       testNum);

            ////////////////////////////////////
            // Fourth step: Starts the simulation
            GridSim.startGridSimulation();
        }
        catch (Exception e)
        {
            System.out.println("Unwanted errors happen");
            System.out.println( e.getMessage() );
            System.out.println("Usage: java Test [time | space] [1-8]");
        }
        System.out.println("=============== END OF TEST ====================");
    }