public static int parsePortFromHostAndPort(String urlPort, int defaultPort) {
        return urlPort.lastIndexOf(':') > 0 ? Integer.valueOf(urlPort.substring(urlPort.lastIndexOf(':') + 1,
                urlPort.length())) : defaultPort;
    }
public static int parsePortFromHostAndPort ( String urlPort , int defaultPort ) { return urlPort . lastIndexOf ( ':' ) > 0 ? Integer . valueOf ( urlPort . substring ( urlPort . lastIndexOf ( ':' ) + 1 , urlPort . length ( ) ) ) : defaultPort ; }
Parse the port from a "hostname:port" formatted string

@param urlPort
@param defaultPort
@return