code: public LocalTime getEndTimeForTrips (Collection<Trip> trips) {
          int latestArrival = Integer.MIN_VALUE;
  
          for (Trip trip : trips) {
              StopTime st = feed.getOrderedStopTimesForTrip(trip.trip_id).iterator().next();
  
              if (st.arrival_time >= latestArrival) {
                  latestArrival = st.arrival_time;
              }
          }
  
          // return end time as 2:00 am if last arrival occurs after midnight
          return LocalTime.ofSecondOfDay(latestArrival % 86399);
      }
docs: Get last arrival time for a set of trips.
  @param trips
  @return last arrival time (if arrival occurs after midnight, time is expressed in terms of following day, e.g., 2:00 AM)