title: How to convert a "formatted double(String)" to double?
body: <p>I have the following code :</p>
  
  <pre><code> NumberFormat nf=NumberFormat.getInstance(Locale.FRANCE);
     nf.setMinimumFractionDigits(3);
      String  s=  nf.format(3456.32);
  //   double d= Double.valueOf(s); error here
      System.out.println(s);
  </code></pre>
  
  <p>This code displays :</p>
  
  <pre><code>3 456,320
  </code></pre>
  
  <p>it's good until now, but imagine when I get the same format from a JFormattedTextField, how I can transform a "3 456,320" as a String to double(3456.32) ?</p>
  
  <p>I have already tried this :</p>
  
  <pre><code>String s="3 456,320";
  double d= Double.valueOf(s);
  </code></pre>
  
  <p>but i get an error...</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>after several tests, I found the code is not so robust ,for example :</p>
  
  <pre><code> //this works
   String s="3456,6567";
  
   NumberFormat nf1=NumberFormat.getInstance(Locale.FRANCE);
  
   double d = (double) nf1.parse(s);
  </code></pre>
  
  <p>but this one:</p>
  
  <pre><code> String s="3456,0";
  
   NumberFormat nf1=NumberFormat.getInstance(Locale.FRANCE);
  
   double d = (double) nf1.parse(s);
  </code></pre>
  
  <p>I get this error :</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Double</p>
  </blockquote>
  
  <p>by cons I find this very robust:</p>
  
  <pre><code>    double d = nf1.parse(s).doubleValue();
  </code></pre>
  
  <p>we must test the software several times !!!</p>