Puoi vedere anche getCanonicalHostName(), però come dice la documentazione:
Gets the fully qualified domain name for this IP address. Best effort method, meaning we may not be able to return the FQDN depending on the underlying system configuration.