code: public static Collection<TimeSlot> calculateTimeSots( Day day, int intervalSeconds, Time startTime, Time endTime)
     {
        if(intervalSeconds <1)
        {
           throw new IllegalArgumentException("interval seconds cannot be less than one");
        }
        
        int count = 1*60*60*24/intervalSeconds;
        
        ArrayList<TimeSlot> slots = new ArrayList<TimeSlot>(count);   
        
        TimeSlot startSlot = TimeSlot.firstSlot(day,startTime, intervalSeconds);
        TimeSlot slot = startSlot;
        
        while(slot != null)
        {
           slots.add(slot);
           slot = slot.nextTimeSlot(intervalSeconds,endTime);
        }          
        
        return slots;
     }
docs: --------------------------------------------