Check for a valid double in Java
<p>I want to check if a <code>String</code> contains a <code>Double</code> not an <code>Integer</code>. I am working in this way;</p>

<pre><code> private boolean isDouble(String str) {
        try {
            Double.parseDouble(str);
            return true;
        }
        catch(NumberFormatException e) {
            return false;
        }

    } 
</code></pre>

<p>For checking it, i simply passed; </p>

<pre><code>isDouble("123");
</code></pre>

<p>But it is not working, giving <code>true</code> in both conditions ("123" ,"123.99"). What is wrong here?</p>