Here you can find the source of getHostIPByHostName(String host)
public static String getHostIPByHostName(String host)
//package com.java2s; //License from project: Apache License import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static String getHostIPByHostName(String host) { InetAddress inetAddress;//from w ww. j a v a 2s . com try { inetAddress = InetAddress.getByName(host); return inetAddress.getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } return null; } }