code: public static String timeToString(long time) {
  
          time += DATE_SHIFT;
  
  
          if (time < 0) {
              throw new IllegalArgumentException("time too early");
          }
  
          String s = Long.toString(time, Character.MAX_RADIX);
  
          if (s.length() > DATE_LEN) {
              throw new IllegalArgumentException("time too late");
          }
  
          // Pad with leading zeros
          if (s.length() < DATE_LEN) {
              StringBuilder sb = new StringBuilder(s);
              while (sb.length() < DATE_LEN) {
                  sb.insert(0, 0);
              }
              s = sb.toString();
          }
  
          return s;
      }
docs: Converts a millisecond time to a string suitable for indexing.
  Supported date range is: 30 BC - 3189
  @throws IllegalArgumentException if the given <code>time</code> is not
  within the supported date range.