title: Is it possible to use String.format for a conditional decimal point?
body: <p>In java, is it possible to use String.format to only show a decimal if there is actually a need?  For example, if I do this:</p>
  
  <pre><code>String.format("%.1f", amount);
  </code></pre>
  
  <p>it will format:
  "1.2222" -> "1.2"
  "1.000" -> "1.0"
  etc,</p>
  
  <p>but in the second case (1.000) I want it to return just "1".  Is this possible with String.format, or am going to have to use a DecimalFormatter?  </p>
  
  <p>If I have to use a decimal formatter, will I need to make a separate DecimalFormatter for each type of format I want? (up to 1 decimal place, up to 2 decimal places, etc)</p>