code: public static Day getLastOfMonth(int dayOfWeek, int month, int year)
    {
      Day day = Day.getNthOfMonth(5, dayOfWeek, month, year);
      return day != null ? day : Day.getNthOfMonth(4, dayOfWeek, month, year);
    }
docs: Find the last of a specific day in a given month. For instance
  last Tuesday of May:
  getLastOfMonth (Calendar.TUESDAY, Calendar.MAY, 2005);
  
  @param dayOfWeek  Weekday to get.
  @param month      Month of day to get.
  @param year       Year of day to get.
  @return           The requested day.