title: Remove trailing zero in Java
body: <p>I have Strings (from DB), which may contain numeric values. If it contains numeric values, I'd like to remove trailing zeros such as:</p>
  
  <ul>
  <li><code>10.0000</code></li>
  <li>
  <code>10.234000</code></li>
  </ul>
  
  <p><code>str.replaceAll("\\.0*$", "")</code>, works on the first one, but not the second one.</p>
  
  <p>A lot of the answers point to use <code>BigDecimal</code>, but the <code>String</code> I get may not be numeric. So I think a better solution probably is through the Regex.</p>