title: Java Double Value With Only One Decimal
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/153724/how-to-round-a-number-to-n-decimal-places-in-java">How to round a number to n decimal places in Java</a>  </p>
  </blockquote>
  
  
  
  <p>I am having a Double value like "1234.9678" . i want to return only with one decimal without rounding or ceiling.</p>
  
  <p>I have used this way but its returning "1234.96" </p>
  
  <pre><code>public double roundTwoDecimals(double d) {
  
  DecimalFormat twoDForm = new DecimalFormat("#.##");
  
  return Double.valueOf(twoDForm.format(d)); }
  </code></pre>
  
  <p>I want only "1234.9",</p>
  
  <p>I have even used this way... But no luck... Can anyone help?</p>
  
  <pre><code>double d = 1234.9678;
  int decimalPlace = 1;
  BigDecimal bd = new BigDecimal( Double.toString(d) );
  bd = bd.setScale( decimalPlace, BigDecimal.ROUND_HALF_UP );
  System.out.println( bd.doubleValue() );
  </code></pre>