code: public static long getDayOfWeekDateOnOrBefore(long fixedDate, int dayOfWeek) {
          long fd = fixedDate - (dayOfWeek - 1);
          if (fd >= 0) {
              return fixedDate - (fd % 7);
          }
          return fixedDate - CalendarUtils.mod(fd, 7);
      }
docs: public for java.util.GregorianCalendar