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;
}

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 ; }
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
