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.Pattern; public class Main { public static boolean isNumber(String str) { if (str == null) { return true; }// ww w. ja va2 s . c om // Pattern pattern = Pattern.compile("[0-9]*"); String regExp = "^(-|\\+)?\\d+(\\.\\d+)?$"; Pattern pattern = Pattern.compile(regExp); return pattern.matcher(str).matches(); } }