Here you can find the source of isNum(String str)
public static boolean isNum(String str)
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isNum(String str) { if (isBlank(str)) { return false; }/* ww w. ja va 2 s .c o m*/ String regEx = "[\\d]+"; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(str); return m.matches(); } public static boolean isBlank(String str) { return (str == null || str == "null" || str.trim().length() == 0); } }