Here you can find the source of isIpV4Address(CharSequence address)
public static boolean isIpV4Address(CharSequence address)
//package com.java2s; /*/*from w w w . ja v a2 s . co m*/ * Copyright 2015-2017 the original author or authors * * This software is licensed under the Apache License, Version 2.0, * the GNU Lesser General Public License version 2 or later ("LGPL") * and the WTFPL. * You may choose either license to govern your use of this software only * upon the condition that you accept all of the terms of either * the Apache License 2.0, the LGPL 2.1+ or the WTFPL. */ import java.util.regex.Pattern; public class Main { private final static Pattern IPV4_PATTERN = Pattern .compile("\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z"); public static boolean isIpV4Address(CharSequence address) { if (address == null) { return false; } return IPV4_PATTERN.matcher(address).matches(); } }