I'm trying to calculate throughput of FCFS algorithm using Java, however it always gives me zero. Am I doing it right?
startTime = System.nanoTime();
total = FCFC(copyBurstTime, copyArrivalTime);
estimatedTime = System.nanoTime() - startTime;
throughput = (float)(5 / estimatedTime);
where FCFS returns two int values total avg. waiting time and total avg. turnaround time, and 5 is the number of processes. throughput variable is of type float. Say estimatedTime = 6844
this is caused by Integer division.
try this instead