code: public static int compare(Date startDate, Date endDate, long targetDate)
     {
        int result = 0;
        if (targetDate < startDate.getTime())
        {
           result = -1;
        }
        else
        {
           if (targetDate > endDate.getTime())
           {
              result = 1;
           }
        }
        return (result);
     }
docs: This method compares a target date with a date range. The method will
  return 0 if the date is within the range, less than zero if the date
  is before the range starts, and greater than zero if the date is after
  the range ends.
  
  @param startDate range start date
  @param endDate range end date
  @param targetDate target date in milliseconds
  @return comparison result