/** * Checks if the {@link InetAddress} is within this subnet * @param address The {@link InetAddress} to check * @return True if the address is within this subnet, false otherwise */ public boolean inSubnet(InetAddress address) { return toSubnet(address) == subnetInt; }
/** * Checks if the {@link InetAddress} is within this subnet * @param address The {@link InetAddress} to check * @return True if the address is within this subnet, false otherwise */ public boolean inSubnet(InetAddress address) { if (address.isAnyLocalAddress()) { return true; } if (address instanceof Inet4Address) { return (int) toSubnet(address) == subnetInt; } else { return toSubnet(address) == subnetLong; } }
/** * Checks if the {@link InetAddress} is within this subnet * @param address The {@link InetAddress} to check * @return True if the address is within this subnet, false otherwise */ public boolean inSubnet(InetAddress address) { if (address.isAnyLocalAddress()) { return true; } if (address instanceof Inet4Address) { return (int) toSubnet(address) == subnetInt; } else { return toSubnet(address) == subnetLong; } }