title: How to return a double with two decimal places?
body: <p>I want to return a double with 2 decimal places (i.e. 123.00). The following are part of the codes. The output is always 123.0. How to get a two decimal places? </p>
  
  <pre><code>public static double getPrice(){
  
      double price = Double.valueOf(showInputDialog("Stock's price : "));
  
      DecimalFormat rounded = new DecimalFormat("###.00");
  
      double newPrice = Double.valueOf(rounded.format(price));
      System.out.println(newPrice);
  
      return newPrice;
  }
  </code></pre>