public static String resolveIpAddress(String hostname) throws UnknownHostException {
    Preconditions.checkNotNull(hostname, "hostname");
    Preconditions.checkArgument(!hostname.isEmpty(),
            "Cannot resolve IP address for empty hostname");
    return InetAddress.getByName(hostname).getHostAddress();
  }
public static String resolveIpAddress ( String hostname ) throws UnknownHostException { Preconditions . checkNotNull ( hostname , "hostname" ) ; Preconditions . checkArgument ( ! hostname . isEmpty ( ) , "Cannot resolve IP address for empty hostname" ) ; return InetAddress . getByName ( hostname ) . getHostAddress ( ) ; }
Resolves a given hostname IP address.

@param hostname the input hostname, which could be an alias
@return the hostname IP address
@throws UnknownHostException if the given hostname cannot be resolved