/** * Find task with max of worker required and return the number * * @param tasks * @return * @throws BusinessException */ public static int extractMaxWorkersRequired(List tasks) throws BusinessException { int max = 0; for (Object task1 : tasks) { Task task = (Task) task1; if (task.getNumberOfWorkers() == null) { throw new BusinessException( "Number of workers is not set for task " + task.getTaskDescription()); } else if (max < task.getNumberOfWorkers()) { max = task.getNumberOfWorkers(); } } return max; }