Here you can find the source of isNumber(String str)
public static boolean isNumber(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 isNumber(String str) { boolean res = false; if (str != null && str.length() > 0) { Pattern pattern = Pattern.compile("^\\d+$"); Matcher m = pattern.matcher(str); if (m.find()) { res = true;/*ww w . j a v a2 s.c o m*/ } } return res; } }