/** * @param ips array of ips to be matched with the subnet defined by subnet and mask * @param subnet subnet address * @param mask netmask in CIDR notation * @return true if any of the IPs in ips falls lies the subnet, otherwise false */ public static boolean matchAny(InetAddress[] ips, InetAddress subnet, int mask) { for (InetAddress inetAddress : ips) { if (match(inetAddress, subnet, mask)) { return true; } } return false; }
/** * @param inetAddress address to be checked against the subnet * @return true if inetAddress is contained in the subnet represented by this instance, otherwise false */ public boolean contains(InetAddress inetAddress) { return IPMatcher.match(inetAddress, getSubnetAddress(), getMask() ); }