Class BigDecimalUtils

java.lang.Object
org.gbif.utils.number.BigDecimalUtils

public class BigDecimalUtils extends Object
Utility class to work with BigDecimal. See DoubleVsBigDecimal test class for more details about BigDecimal
  • Method Details

    • fromDouble

      public static BigDecimal fromDouble(Double value, boolean stripTrailingZeros)
      Convert a double to a BigDecimal.
      Parameters:
      value - non-null value to convert into a BigDecimal.
      stripTrailingZeros - should the trailing zero(s) be removed? e.g. 25.0 would become 25
      Returns:
      instance of BigDecimal