How to check whether a string is numeric or not , using java?

Use the following code to check whether a string is numeric or not, using java

public boolean isNumeric(String string)
{
                return string.matches("^[-+]?\\d+(\\.\\d+)?$");
}

Search