code: public static boolean isYear(String s) {
          if (isEmpty(s)) return defaultEmptyOK;
  
          if (!isNonnegativeInteger(s)) return false;
          return ((s.length() == 2) || (s.length() == 4));
      }
docs: isYear returns true if string s is a valid
  Year number.  Must be 2 or 4 digits only.
  
  For Year 2000 compliance, you are advised
  to use 4-digit year numbers everywhere.