title: Check if a string is a hostname or an ip-address in Java
body: <p>I want to check if a string is a hostname or an ip-address in Java. Is there an API to do it or must I write a parser myself? </p>
  
  <p>The problem is complex because there are IPv4 addresses, short and long IPv6 addresses, short hostnames and FQDN host names.</p>