Here you can find the source of isIPValid(final String ipv4)
public static boolean isIPValid(final String ipv4)
//package com.java2s; //License from project: Open Source License public class Main { private final static java.util.regex.Pattern pattern = java.util.regex.Pattern .compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"); public static boolean isIPValid(final String ipv4) { java.util.regex.Matcher matcher = pattern.matcher(ipv4); return matcher.matches(); }/*from w w w . ja v a 2 s . co m*/ }