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