I'd like to check if the user submitted adress ip is a valid public IPv4 (non loopback, non local, non reserved).For that purpose, I came up with that method, but I was wondering if this was enough or if I was missing some tests.private boolean isValidPublicIp(String ip) {    try    {        Inet4Address address = (Inet4Address) InetAddress.getByAddress(ip.getBytes());        if (!address.isSiteLocalAddress() && !address.isAnyLocalAddress() && !address.isLinkLocalAddress() && !address.isLoopbackAddress() && !address.isMulticastAddress()) {            return true;        }    }    catch (UnknownHostException exception) {}    return false;}
Test if given ip is a public one?
java;networking