GanttCalendar maxEnd = null;
GanttCalendar minStart = null;
for (int i = 0; i < nested.length; i++) {
Task nextNested = nested[i];
GanttCalendar nextStart = nextNested.getStart();
if (minStart == null || nextStart.compareTo(minStart) < 0) {
minStart = nextStart;
}
GanttCalendar nextEnd = nextNested.getEnd();
if (maxEnd == null || nextEnd.compareTo(maxEnd) > 0) {
maxEnd = nextEnd;