title: Double.parseDouble loses a decimal place
body: <p>I´ve encountered a problem that I can not solve. Tried various solutions described on the site with no result.
  I´m passing a string “<strong>total</strong>” that translates to 30.00 but on Doubleparse it changes to <code>30.0</code></p>
  
  <p>I need the double to be <code>30.00</code> because it has to be added to an arraylist, and also displayed as text, as <code>30.00</code> and not as <code>30.0</code></p>
  
  <p>I´ve tried </p>
  
  <pre><code>DecimalFormat df = new DecimalFormat("#.##");
  Double number_total = Double.parseDouble(df.format(total));
  </code></pre>
  
  <blockquote>
    <p>ERROR: java.lang.IllegalArgumentException: Bad class: class
    java.lang.String
        at java.text.NumberFormat.format(NumberFormat.java:304)
        at java.text.DecimalFormat.format(DecimalFormat.java:702)
        at java.text.Format.format(Format.java:93)
        at   com.example.jc.salesman.MainActivity.Totais(MainActivity.java:338)
        at   com.example.jc.salesman.MainActivity$2.onClick(MainActivity.java:235)</p>
  </blockquote>
  
  <pre><code>String strSum = ((String.format("%.2f", Double.toString(sum))));
  </code></pre>
  
  <blockquote>
    <p>ERROR: Process: com.example.jc.salesman, PID: 26845
    java.util.IllegalFormatConversionException: %f can't format<br>
    java.lang.String arguments
        at java.util.Formatter.badArgumentType(Formatter.java:1489)
        at java.util.Formatter.transformFromFloat(Formatter.java:2038)
        at java.util.Formatter.transform(Formatter.java:1465)
        at java.util.Formatter.doFormat(Formatter.java:1081)
        at java.util.Formatter.format(Formatter.java:1042)
        at java.util.Formatter.format(Formatter.java:1011)
        at java.lang.String.format(String.java:1999)
        at java.lang.String.format(String.java:1973)
        at   </p>
    
    <p>com.example.jc.salesman.MainActivity.Totais(MainActivity.java:368)</p>
  </blockquote>
  
  <p>I even forced Locale in main,</p>
  
  <pre><code>Locale.setDefault(new Locale("en", "US"));
  </code></pre>
  
  <p>Please HELP :)</p>
  
  <pre><code>public void Total (String total){
  
      Log.d("log2","total: " + total);// it prints 30.00
  
      Double number_total = Double.parseDouble(total);
  
      Log.d("log2","number_total: " + total);// it prints 30.0
      losing a decimal place.
  
      array_Total.add (number_total); //Arraylist&lt;Double
      sum (double) = sum + number_total;
      String strSum = (Double.toString(sum));
      total.setText (strSum);
  }
  </code></pre>