List of utility methods to do IP Address Check
boolean | checkIP(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) ... |
void | checkIpAddress(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"); |