title: how to use DecimalFormat() to only output significant fractional digits
body: <p>Given <code>0.01835132889570552</code>, the digits <code>1835</code> are significant (and might need to round up), and the digits <code>132889570552</code> are insignificant, so we don't want to put them into our user's input systems.</p>
  <p>Any digits to the left of the decimal place are significant, and the minimum number of numerals to the right of the decimal place is 4.</p>
  <p>We need to pass this test:</p>
  <pre><code>assertEquals(&quot;1,835.1329&quot;, formatInsignificantDigits(1835.13288957055));
  assertEquals(&quot;183.5133&quot;, formatInsignificantDigits(183.513288957055));
  assertEquals(&quot;18.3513&quot;, formatInsignificantDigits(18.3513288957055));
  assertEquals(&quot;1.8351&quot;, formatInsignificantDigits(1.83513288957055));
  assertEquals(&quot;0.1835&quot;, formatInsignificantDigits(0.183513288957055));
  assertEquals(&quot;0.01835&quot;, formatInsignificantDigits(0.0183513288957055));
  assertEquals(&quot;0.001835&quot;, formatInsignificantDigits(0.00183513288957055));
  assertEquals(&quot;0.0001835&quot;, formatInsignificantDigits(0.000183513288957055));
  </code></pre>
  <p>Note that <code>183.5133</code> rounded up by <code>0.0001</code>.</p>
  <p>So the question is: How to write <code>formatInsignificantDigits()</code> without resorting to brute force or string surgery? I will answer my own question with a little brute force, and then we can see what others come up with.</p>