1. import org.apache.commons.lang3.RandomUtils;
    2. import java.util.regex.Pattern;
    3. /**
    4. * @author klq
    5. */
    6. public class MobileNoUtil {
    7. 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}$");
    8. /**
    9. * 校验是否为手机号
    10. * @param mobileNo 手机号
    11. */
    12. public static boolean checkIsMobile(String mobileNo){
    13. return pattern.matcher(mobileNo).find();
    14. }
    15. public static void main(String[] args) {
    16. for (int i = 0; i < 100; i++) {
    17. long l = RandomUtils.nextLong(10000000000L, 20000000000L);
    18. String no = l + "";
    19. System.out.println(no + ":" + MobileNoUtil.checkIsMobile(no));
    20. }
    21. }
    22. }