Here you can find the source of isIP(String ip)
public static boolean isIP(String ip)
//package com.java2s; //License from project: Apache License import java.util.regex.Pattern; public class Main { public static boolean isIP(String ip) { Pattern pattern = 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])$"); return pattern.matcher(ip).matches(); }/*from w w w.j a v a 2 s. co m*/ }