question: public static final double parseTime ( final String time , final char separator ) { if ( time == null || time . length ( ) == 0 || time . equals ( "undefined" ) ) { return Time . UNDEFINED_TIME ; } boolean isNegative = ( time . charAt ( 0 ) == '-' ) ; String [ ] strings = ( isNegative ? StringUtils . explode ( time . substring ( 1 ) , separator ) : StringUtils . explode ( time , separator ) ) ; double seconds = 0 ; if ( strings . length == 1 ) { seconds = Math . abs ( Double . parseDouble ( strings [ 0 ] ) ) ; } else if ( strings . length == 2 ) { int h = Integer . parseInt ( strings [ 0 ] ) ; int m = Integer . parseInt ( strings [ 1 ] ) ; if ( ( m < 0 ) || ( m > 59 ) ) { throw new IllegalArgumentException ( "minutes are out of range in " + time ) ; } seconds = Math . abs ( h ) * 3600 + m * 60 ; } else if ( strings . length == 3 ) { int h = Integer . parseInt ( strings [ 0 ] ) ; int m = Integer . parseInt ( strings [ 1 ] ) ; double s = Double . parseDouble ( strings [ 2 ] ) ; if ( ( m < 0 ) || ( m > 59 ) ) { throw new IllegalArgumentException ( "minutes are out of range in " + time ) ; } if ( ( s < 0 ) || ( s >= 60 ) ) { throw new IllegalArgumentException ( "seconds are out of range in " + time ) ; } seconds = Math . abs ( h ) * 3600 + m * 60 + s ; } else { throw new IllegalArgumentException ( "time format is not valid in " + time ) ; } if ( isNegative ) { seconds = - seconds ; } return seconds ; }
target:  Parses the given string for a textual representation for time and returns the time value in seconds past midnight. The following formats are recognized: HH:mm:ss, HH:mm, ssss.