code: public static long parseTimeSize(String timeSize) {
      double alpha = 0.0001;
      String time = "";
      String size = "";
      Matcher m = SEP_DIGIT_LETTER.matcher(timeSize);
      if (m.matches()) {
        time = m.group(1);
        size = m.group(2);
      }
      double douTime = Double.parseDouble(time);
      long sign = 1;
      if (douTime < 0) {
        sign = -1;
        douTime = -douTime;
      }
      size = size.toLowerCase();
      if (size.isEmpty() || size.equalsIgnoreCase("ms")
          || size.equalsIgnoreCase("millisecond")) {
        return sign * (long) (douTime + alpha);
      } else if (size.equalsIgnoreCase("s") || size.equalsIgnoreCase("sec")
          || size.equalsIgnoreCase("second")) {
        return sign * (long) (douTime * Constants.SECOND + alpha);
      } else if (size.equalsIgnoreCase("m") || size.equalsIgnoreCase("min")
          || size.equalsIgnoreCase("minute")) {
        return sign * (long) (douTime * Constants.MINUTE + alpha);
      } else if (size.equalsIgnoreCase("h") || size.equalsIgnoreCase("hr")
          || size.equalsIgnoreCase("hour")) {
        return sign * (long) (douTime * Constants.HOUR + alpha);
      } else if (size.equalsIgnoreCase("d") || size.equalsIgnoreCase("day")) {
        return sign * (long) (douTime * Constants.DAY + alpha);
      } else {
        throw new IllegalArgumentException("Fail to parse " + timeSize + " to milliseconds");
      }
    }
docs: Parses a String size to Milliseconds. Supports negative numbers.
  
  @param timeSize the size of a time, e.g. 1M, 5H, 10D, -1
  @return the time size in milliseconds