Java InetAddress Check isWindowsAutoConfiguredIPv4Address(InetAddress add)

Here you can find the source of isWindowsAutoConfiguredIPv4Address(InetAddress add)

Description

Determines whether the address is the result of windows auto configuration.

License

LGPL

Parameter

Parameter Description
add the address to inspect

Return

true if the address is autoconfigured by windows, false otherwise.

Declaration

public static boolean isWindowsAutoConfiguredIPv4Address(InetAddress add) 

Method Source Code


//package com.java2s;
/*//from ww w.  j a  v  a2 s  . c  om
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

import java.net.*;

public class Main {
    /**
     * Determines whether the address is the result of windows auto configuration.
     * (i.e. One that is in the 169.254.0.0 network)
     * @param add the address to inspect
     * @return true if the address is autoconfigured by windows, false otherwise.
     */
    public static boolean isWindowsAutoConfiguredIPv4Address(InetAddress add) {
        return (add.getAddress()[0] & 0xFF) == 169 && (add.getAddress()[1] & 0xFF) == 254;
    }
}

Related

  1. isValidInetAddress(String address)
  2. isValidInetAddress(String ip)
  3. isValidInetAddress(String IP)
  4. isValidIntranetAddress(InetAddress address)
  5. isValidIpAddress(InetAddress ip)
  6. sortAddresses(List addressList)