Java Utililty Methods IP Address Check

List of utility methods to do IP Address Check

Description

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

Method

booleancheckIP(String requestIP, String[] ips)
check IP
for (String ip : ips) {
    if (requestIP.equals(ip))
        return true;
    if ((ip.indexOf("-")) >= 0) {
        String[] ipPart = requestIP.split("\\.");
        String[] ipOpenPart = ip.split("\\-")[0].split("\\.");
        String[] ipEndPart = ip.split("\\-")[1].split("\\.");
        if (ipOpenPart.length != ipPart.length || ipEndPart.length != ipPart.length)
...
voidcheckIpAddress(String ipAddress)
check Ip Address
if (!ipAddress.matches(
        "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")) {
    throw new IllegalArgumentException("Mac Address must be in the form 255.255.255.255");