title: Formatting Floating Point Numbers
body: <p>I have a variable of type <code>double</code>, I need to print it in upto 3 decimals of precision but it shouldn't have any trailing zeros...</p>
  
  <p>eg. I need</p>
  
  <pre><code>2.5 // not 2.500
  2   // not 2.000
  1.375 // exactly till 3 decimals
  2.12  // not 2.120
  </code></pre>
  
  <p>I tried using <code>DecimalFormatter</code>, Am i doing it wrong?</p>
  
  <pre><code>DecimalFormat myFormatter = new DecimalFormat("0.000");
  myFormatter.setDecimalSeparatorAlwaysShown(false);
  </code></pre>
  
  <p>Thanks. :)</p>