Here you can find the source of isNumeric(String number)
public static boolean isNumeric(String number)
//package com.java2s; //License from project: LGPL import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isNumeric(String number) { boolean isValid = false; /*Number: A numeric value will have following format: ^[-+]?: Starts with an optional "+" or "-" sign. [0-9]*: May have one or more digits. \\.? : May contain an optional "." (decimal point) character. [0-9]+$ : ends with numeric digit. *//* www.j a va 2s . co m*/ //Initialize reg ex for numeric data. String expression = "[0-9]*"; CharSequence inputStr = number; Pattern pattern = Pattern.compile(expression); Matcher matcher = pattern.matcher(inputStr); if (matcher.matches()) { isValid = true; } return isValid; } }