Here you can find the source of isLegalPhoneNumber(String phoneNumber)
public static boolean isLegalPhoneNumber(String phoneNumber)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isLegalPhoneNumber(String phoneNumber) { String strPattern = "^((13[0-9])|(14[5,7])|(15[0-9])|(18[0-9]))[0-9]{8}$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(phoneNumber); return m.matches(); }//from w w w. j a va 2s. c o m }