Java tutorial
//package com.java2s; //License from project: Apache License import android.text.TextUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean checkPhoneNumber(String phoneNumber) { if (TextUtils.isEmpty(phoneNumber)) { return false; } String reg = "^[0-9]{11}$"; Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(phoneNumber); return matcher.matches(); } }