private static void validatePort(int port) {
    if (port < 0 || port > 65535) {
      throw new IllegalArgumentException("Port number out of range (0-65535).");
    }
  }
Returns an integer representation of the port number.
Also validates whether the given string represents a valid port number.
A valid port number is an integer between 0 and 65535 inclusive.

@param portString The string representing the port number.
@return {@code int} the port number.
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/common/IPStackUtils.java