private static long humanReadableIntervalToSec(final String humanReadableInterval)
    throws HBaseException {
    if (humanReadableInterval == null || humanReadableInterval.equalsIgnoreCase("FOREVER")) {
      return HConstants.FOREVER;
    }

    try {
      return Long.parseLong(humanReadableInterval);
    } catch (NumberFormatException ex) {
      LOG.debug("Given interval value is not a number, parsing for human readable format");
    }

    String days = null;
    String hours = null;
    String minutes = null;
    String seconds = null;
    String expectedTtl = null;
    long ttl;

    Matcher matcher = PrettyPrinter.INTERVAL_PATTERN.matcher(humanReadableInterval);
    if (matcher.matches()) {
      expectedTtl = matcher.group(2);
      days = matcher.group(4);
      hours = matcher.group(6);
      minutes = matcher.group(8);
      seconds = matcher.group(10);
    } else {
      LOG.warn("Given interval value '{}' is not a number and does not match human readable format,"
        + " value will be set to 0.", humanReadableInterval);
    }

    ttl = 0;
    ttl += days != null ? Long.parseLong(days) * HConstants.DAY_IN_SECONDS : 0;
    ttl += hours != null ? Long.parseLong(hours) * HConstants.HOUR_IN_SECONDS : 0;
    ttl += minutes != null ? Long.parseLong(minutes) * HConstants.MINUTE_IN_SECONDS : 0;
    ttl += seconds != null ? Long.parseLong(seconds) : 0;

    if (expectedTtl != null && Long.parseLong(expectedTtl) != ttl) {
      throw new HBaseException(
        "Malformed TTL string: TTL values in seconds and human readable" + "format do not match");
    }
    return ttl;
  }
Convert a human readable time interval to seconds. Examples of the human readable time
intervals are: 50 DAYS 1 HOUR 30 MINUTES , 25000 SECONDS etc. The units of time specified can
be in uppercase as well as lowercase. Also, if a single number is specified without any time
unit, it is assumed to be in seconds.
@return value in seconds
hbase-common/src/main/java/org/apache/hadoop/hbase/util/PrettyPrinter.java