public static void main(String[] args){
  Log.printLine("Starting NetworkExample4...");
  try {
    int num_user=1;
    Calendar calendar=Calendar.getInstance();
    boolean trace_flag=false;
    CloudSim.init(num_user,calendar,trace_flag);
    Datacenter datacenter0=createDatacenter("Datacenter_0");
    DatacenterBroker broker=createBroker();
    int brokerId=broker.getId();
    vmlist=new ArrayList<Vm>();
    int vmid=0;
    int mips=250;
    long size=10000;
    int ram=512;
    long bw=1000;
    int pesNumber=1;
    String vmm="Xen";
    Vm vm1=new Vm(vmid,brokerId,mips,pesNumber,ram,bw,size,vmm,new CloudletSchedulerTimeShared());
    vmlist.add(vm1);
    broker.submitVmList(vmlist);
    cloudletList=new ArrayList<Cloudlet>();
    int id=0;
    long length=40000;
    long fileSize=300;
    long outputSize=300;
    UtilizationModel utilizationModel=new UtilizationModelFull();
    Cloudlet cloudlet1=new Cloudlet(id,length,pesNumber,fileSize,outputSize,utilizationModel,utilizationModel,utilizationModel);
    cloudlet1.setUserId(brokerId);
    cloudletList.add(cloudlet1);
    broker.submitCloudletList(cloudletList);
    NetworkTopology.addLink(datacenter0.getId(),broker.getId(),10.0,10);
    CloudSim.startSimulation();
    List<Cloudlet> newList=broker.getCloudletReceivedList();
    CloudSim.stopSimulation();
    printCloudletList(newList);
    Log.printLine("NetworkExample4 finished!");
  }
 catch (  Exception e) {
    e.printStackTrace();
    Log.printLine("The simulation has been terminated due to an unexpected error");
  }
}

public static void main ( String [ ] args ) { Log . printLine ( "Starting NetworkExample4..." ) ; try { int num_user = 1 ; Calendar calendar = Calendar . getInstance ( ) ; boolean trace_flag = false ; CloudSim . init ( num_user , calendar , trace_flag ) ; Datacenter datacenter0 = createDatacenter ( "Datacenter_0" ) ; DatacenterBroker broker = createBroker ( ) ; int brokerId = broker . getId ( ) ; vmlist = new ArrayList < Vm > ( ) ; int vmid = 0 ; int mips = 250 ; long size = 10000 ; int ram = 512 ; long bw = 1000 ; int pesNumber = 1 ; String vmm = "Xen" ; Vm vm1 = new Vm ( vmid , brokerId , mips , pesNumber , ram , bw , size , vmm , new CloudletSchedulerTimeShared ( ) ) ; vmlist . add ( vm1 ) ; broker . submitVmList ( vmlist ) ; cloudletList = new ArrayList < Cloudlet > ( ) ; int id = 0 ; long length = 40000 ; long fileSize = 300 ; long outputSize = 300 ; UtilizationModel utilizationModel = new UtilizationModelFull ( ) ; Cloudlet cloudlet1 = new Cloudlet ( id , length , pesNumber , fileSize , outputSize , utilizationModel , utilizationModel , utilizationModel ) ; cloudlet1 . setUserId ( brokerId ) ; cloudletList . add ( cloudlet1 ) ; broker . submitCloudletList ( cloudletList ) ; NetworkTopology . addLink ( datacenter0 . getId ( ) , broker . getId ( ) , 10.0 , 10 ) ; CloudSim . startSimulation ( ) ; List < Cloudlet > newList = broker . getCloudletReceivedList ( ) ; CloudSim . stopSimulation ( ) ; printCloudletList ( newList ) ; Log . printLine ( "NetworkExample4 finished!" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; Log . printLine ( "The simulation has been terminated due to an unexpected error" ) ; } }
creates main ( ) to run this example
