Here you can find the source of isIpv4Correct(String ipAddress)
public static boolean isIpv4Correct(String ipAddress)
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static final Pattern patternIpV4 = Pattern.compile( "^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$"); public static boolean isIpv4Correct(String ipAddress) { Matcher matcher = patternIpV4.matcher(ipAddress); return matcher.matches(); }// w ww . ja v a2 s .co m }