Java InetAddress Check isLikelyBroadcast(InetAddress address)

Here you can find the source of isLikelyBroadcast(InetAddress address)

Description

Checks whether the passed address is likely either a broadcast or network address

License

GNU General Public License

Parameter

Parameter Description
address a parameter

Declaration

public static boolean isLikelyBroadcast(InetAddress address) 

Method Source Code

//package com.java2s;
/**/*  w  w w .j a v a2 s.co  m*/
 * This file is a part of Angry IP Scanner source code,
 * see http://www.angryip.org/ for more information.
 * Licensed under GPLv2.
 */

import java.net.InetAddress;

public class Main {
    /**
     * Checks whether the passed address is likely either a broadcast or network address
     * @param address
     */
    public static boolean isLikelyBroadcast(InetAddress address) {
        byte[] bytes = address.getAddress();
        return bytes[bytes.length - 1] == 0 || bytes[bytes.length - 1] == (byte) 0xFF;
    }
}

Related

  1. isIpAddressInRange(InetAddress ipStart, InetAddress ipEnd, InetAddress ipToCheck)
  2. isIPLocal(final InetAddress adr)
  3. isIPv6(final InetAddress ip)
  4. isIPv6(InetAddress addr)
  5. isIPv6UniqueSiteLocal(InetAddress address)
  6. isLinkLocalIPv4Address(InetAddress add)
  7. isLinkLocalNetwork(InetAddress addr)
  8. isLocal(InetAddress a)
  9. isLocalAddress(InetAddress addr)