public String asString() {
    String bindAddressString = null;
    if (hostAddress == null) {
      try {
        bindAddressString = LocalHostUtil.getLocalHostName();
      } catch (java.net.UnknownHostException ignored) {
      }
    } else {
      bindAddressString = hostAddress.getHostName();
    }
    StringBuilder locatorString = new StringBuilder(String.valueOf(bindAddressString));
    Integer port = getPort();
    if (port != null && port > 0) {
      locatorString.append('[').append(getPort()).append(']');
    }
    return locatorString.toString();
  }
Get the string representation of this <code>Locator</code> in host[port] format.

@return the string representation of this <code>Locator</code> in host[port] format
geode-core/src/main/java/org/apache/geode/distributed/Locator.java