Java BigDecimal stripTrailingZeros(BigDecimal value)

Here you can find the source of stripTrailingZeros(BigDecimal value)

Description

Workaround for <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6480539">bug #6480539</a>: BigDecimal.stripTrailingZeros() has no effect on zero itself ("0.0").

License

Open Source License

Declaration

public static BigDecimal stripTrailingZeros(BigDecimal value) 

Method Source Code


//package com.java2s;

import java.math.BigDecimal;

public class Main {
    /**/*from w w w .  j  a va  2  s.  c  o  m*/
     * Workaround for <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6480539">bug #6480539</a>:
     * BigDecimal.stripTrailingZeros() has no effect on zero itself ("0.0").
     */
    public static BigDecimal stripTrailingZeros(BigDecimal value) {
        return (value.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : value.stripTrailingZeros());
    }
}

Related

  1. stdDevMaxFromMapField(List> dataList, String fieldName, BigDecimal stdDevMultiplier)
  2. Str2BigDecimal(String a)
  3. str2BigDicimal(String strbigdecimal)
  4. stripAndOrRescale(BigDecimal value)
  5. stripTrailingZeros(BigDecimal bigDecimal)
  6. stripTrailingZeros(final BigDecimal decimal)
  7. strToBigDecimal(final String arg)
  8. strValueBigDecimal(Number number)
  9. tangent(BigDecimal x)