private void printGridletList(GridletList list, String name,
                            boolean detail, double gridletLatencyTime[])
    {
        int size = list.size();
        Gridlet gridlet = null;

        String indent = "    ";
        System.out.println();
        System.out.println("============= OUTPUT for " + name + " ==========");
        System.out.println("Gridlet ID" + indent + "STATUS" + indent +
                           "Resource ID" + indent + "Cost" + indent +
                           "CPU Time"+ indent + "Latency");

        // a loop to print the overall result
        int i = 0;
        for (i = 0; i < size; i++)
        {
            gridlet = (Gridlet) list.get(i);
            System.out.print(indent + gridlet.getGridletID() + indent
                             + indent);

            System.out.print(gridlet.getGridletStatusString());

            System.out.println(indent + indent + gridlet.getResourceID() +
                               indent + indent + gridlet.getProcessingCost() +
                               indent + indent + gridlet.getActualCPUTime()+
                               indent + indent +
                               gridletLatencyTime[gridlet.getGridletID()]);

            writeFin(name, gridlet.getGridletID(),
                     GridSim.getEntityName(gridlet.getResourceID()),
                     gridlet.getProcessingCost(), gridlet.getActualCPUTime(),
                     GridSim.clock());



        }


        if (detail == true)
        {
            // a loop to print each Gridlet's history
            for (i = 0; i < size; i++)
            {
                gridlet = (Gridlet) list.get(i);
                System.out.println(gridlet.getGridletHistory());

                System.out.print("Gridlet #" + gridlet.getGridletID());
                System.out.println(", length = " + gridlet.getGridletLength()
                                   + ", finished so far = " +
                                   gridlet.getGridletFinishedSoFar());
                System.out.println("======================================\n");
            }
        }

        System.out.println("=================================================");

    }