Generally speaking, "InetAddress" class provides methods to resolve host names to their IP addresses and vice versa.
This program shows how to use the InetAddress class. This program gets the IP address and the domain.
import java.io.*;
import java.net.*;
public class InetAddressDemo {
public static void main(String args[]) {
try {
String host = "noteoneverything.blogspot.com";
InetAddress ip = InetAddress.getByName(host);
System.out.println("IP Address : " + ip.getHostAddress());
System.out.println("Hostname : " + ip.getHostName());
} catch(UnknownHostException uhe) {
System.out.println("Host Not Found");
} catch(Exception e) {
System.out.println(e);
}
}
}