code: public int compareTo(DateValue dv) {
          long dvComparable =
                  (((((long) dv.year()) << 4) + dv.month()) << 5) + dv.day();
          long dtbComparable =
                  ((((long) year << 4) + month << 5)) + day;
          if (dv instanceof TimeValue) {
              TimeValue tv = (TimeValue) dv;
              dvComparable = (((((dvComparable << 5) + tv.hour()) << 6) + tv.minute())
                      << 6) + tv.second();
              dtbComparable = (((((dtbComparable << 5) + hour) << 6) + minute)
                      << 6) + second;
          }
          long delta = dtbComparable - dvComparable;
          return delta < 0 ? -1 : delta == 0 ? 0 : 1;
      }
docs: behavior undefined unless normalized.
  If you're not sure whether it's appropriate to use this method, use
  <code>toDateValue().compareTo(dv)</code> instead.