Internet Addresses in Java
java.net.InetAddress class
You get an address by using static methods:
ad = InetAddress.getByName(hostname);
myAddress = InetAddress.getLocalHost();