I don't think there's any built-in way to extract the domain name. You'd probably just have to look for
patterns matching valid domain name formats.
As for getting "the" URL, no, that's not possible. There is no single URL associated with an IP address. A URL is a completely independent thing that has a host component, but there might be zero, one, or many valid URLs for any given host. You can of course construct one using a common format from the host name or IP address, just by building up the appropriate
String, and then
test to see if you get a response from that URL. You don't even need the InetAddress for that.