Java Utililty Methods InetAddress Check

List of utility methods to do InetAddress Check

Description

The list of methods to do InetAddress Check are organized into topic(s).

Method

booleanisValidIntranetAddress(InetAddress address)
is Valid Intranet Address
if (address == null || address.isLoopbackAddress())
    return false;
String name = address.getHostAddress();
return (name != null && !ANYHOST.equals(name) && !LOCALHOST.equals(name)
        && IP_PATTERN.matcher(name).matches() && IP_INTRANET_PATTERN.matcher(name).matches());
booleanisValidIpAddress(InetAddress ip)
Determine if IP address is valid for BUG to use for event notification.
if (ip instanceof Inet6Address) {
    return false;
if (ip.getAddress()[0] == 127) {
    return false;
return true;
booleanisWindowsAutoConfiguredIPv4Address(InetAddress add)
Determines whether the address is the result of windows auto configuration.
return (add.getAddress()[0] & 0xFF) == 169 && (add.getAddress()[1] & 0xFF) == 254;
voidsortAddresses(List addressList)
sort Addresses
Collections.sort(addressList, new Comparator<InetAddress>() {
    @Override
    public int compare(InetAddress o1, InetAddress o2) {
        return compareBytes(o1.getAddress(), o2.getAddress());
});