import org.apache.commons.lang3.RandomUtils;
import java.util.regex.Pattern;
/**
* @author klq
*/
public class MobileNoUtil {
private static final Pattern pattern = Pattern.compile("^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\\d{8}$");
/**
* 校验是否为手机号
* @param mobileNo 手机号
*/
public static boolean checkIsMobile(String mobileNo){
return pattern.matcher(mobileNo).find();
}
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
long l = RandomUtils.nextLong(10000000000L, 20000000000L);
String no = l + "";
System.out.println(no + ":" + MobileNoUtil.checkIsMobile(no));
}
}
}