Here you can find the source of isNumericOnly(String pString)
public static boolean isNumericOnly(String pString)
//package com.java2s; import java.util.regex.Pattern; public class Main { public static boolean isNumericOnly(String pString) { return Pattern.matches("[0-9[-\\s]]+", pString); }/*from w w w . j a va2 s .c om*/ }