code: public static int convertStringToTimeSeconds(String time) {
          int result = 0;
          if (time.endsWith("H")) {
              int hoursToAdd = Integer.valueOf(StringUtils.remove(time, 'H'));
              result = (60 * 60) * hoursToAdd;
          } else if (time.endsWith("M")) {
              int minsToAdd = Integer.valueOf(StringUtils.remove(time, 'M'));
              result = 60 * minsToAdd;
          } else if (time.endsWith("S")) {
              int secsToAdd = Integer.valueOf(StringUtils.remove(time, 'S'));
              result = secsToAdd;
          }
          return result;
      }
docs: Converts a string denoting an amount of time into seconds. Strings are expected to follow this form where # equals a digit: #M The following are permitted for denoting time: H = hours, M = minutes, S = seconds
  
  @param time
  time
  @return time in seconds