Here you can find the source of resolveHost(String hostname)
public static String resolveHost(String hostname)
//package com.java2s; //License from project: Open Source License import java.net.InetAddress; import java.net.UnknownHostException; public class Main { /**// w w w .ja v a 2s. c o m * Resolves hostname and returns ip address as a string. */ public static String resolveHost(String hostname) { try { InetAddress addr = InetAddress.getByName(hostname); byte[] ipAddr = addr.getAddress(); StringBuilder ipAddrStr = new StringBuilder(15); for (int i = 0; i < ipAddr.length; i++) { if (i > 0) ipAddrStr.append('.'); ipAddrStr.append(ipAddr[i] & 0xFF); } return ipAddrStr.toString(); } catch (UnknownHostException uhex) { return null; } } }