You'll need to do a DNS lookup to find the host name for a particular IP address. Note that more than one domain can be hosted on the same machine (particularly for smaller sites), so you may not get what you thought you'd be getting.
If you want to do this programmatically from Java code, check out the DNSJava library.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com