public static boolean isMobile(String phoneNum){
  if (phoneNum != null) {
    Pattern p=Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
    Matcher m=p.matcher(phoneNum);
    return m.matches();
  }
 else {
    return false;
  }
}

public static boolean isMobile ( String phoneNum ) { if ( phoneNum != null ) { Pattern p = Pattern . compile ( "^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$" ) ; Matcher m = p . matcher ( phoneNum ) ; return m . matches ( ) ; } else { return false ; } }
( phonenum is null return false ) yes return true ; no return false ;
