Here you can find the source of getIpByHost(String hostName)
public static String getIpByHost(String hostName)
//package com.java2s; //License from project: Apache License import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static String getIpByHost(String hostName) { try {/* w w w .j a v a 2 s .c o m*/ return InetAddress.getByName(hostName).getHostAddress(); } catch (UnknownHostException e) { return hostName; } } }