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.Pattern; public class Main { public static boolean isNum(String str) { if ((str == null) || (str.equals(""))) { return false; }/*from ww w . j a v a2s.c o m*/ Pattern pattern = Pattern.compile("[0-9]*"); return pattern.matcher(str).matches(); } public static boolean equals(String str1, String str2) { return str1 == null ? false : str2 == null ? true : str1.equals(str2); } }