Here you can find the source of isNumber(String str)
public static boolean isNumber(String str)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static Pattern numberPattern = Pattern.compile("^\\d+\\.*\\d*$"); public static boolean isNumber(String str) { if (isEmpty(str)) { return false; }/*from www.java 2 s . c om*/ Matcher matcher = numberPattern.matcher(str); return matcher.matches(); } public static boolean isEmpty(String str) { return str == null || str.isEmpty(); } }