NumberUtils.isNumber
or StringUtils.isNumeric
from Apache Commons Lang.
You can also use StringUtils.isNumericSpace
which returns true
for empty strings and ignores internal spaces in the string. (The linked javadocs contain detailed examples for each method.)