Top "Bigdecimal" questions

BigDecimal is a numeric object type in Java that represents decimal numbers with arbitrary precision.

Safe String to BigDecimal conversion

I'm trying to read some BigDecimal values from the string. Let's say I have this String: "1,000,000,000.999999999999999" and I want to …

java parsing bigdecimal
ArithmeticException: "Non-terminating decimal expansion; no exact representable decimal result"

Why does the following code raise the exception shown below? BigDecimal a = new BigDecimal("1.6"); BigDecimal b = new BigDecimal("9.2"); a.divide(…

java bigdecimal arithmeticexception
Double vs. BigDecimal?

I have to calculate some floating point variables and my colleague suggest me to use BigDecimal instead of double since …

java floating-point double bigdecimal
Converting BigDecimal to Integer

I have Hibernate method which returns me a BigDecimal. I have another API method to which I need to pass …

java integer casting bigdecimal
Compare if BigDecimal is greater than zero

How can I compare if BigDecimal value is greater than zero?

java compare bigdecimal
How to change the decimal separator of DecimalFormat from comma to dot/point?

I have this little crazy method that converts BigDecimal values into nice and readable Strings. private String formatBigDecimal(BigDecimal bd){ …

java android bigdecimal decimal-point decimalformat
BigDecimal to string

I have a BigDecimal object and i want to convert it to string. The problem is that my value got …

java string bigdecimal
How to check if BigDecimal variable == 0 in java?

I have the following code in Java; BigDecimal price; // assigned elsewhere if (price.compareTo(new BigDecimal("0.00")) == 0) { return true; } What is …

java bigdecimal
Convert string to BigDecimal in java

I am reading a currency from XML into Java. String currency = "135.69"; When I convert this to BigDecimal I get: System.…

java bigdecimal
Convert seconds value to hours minutes seconds?

I've been trying to convert a value of seconds (in a BigDecimal variable) to a string in an editText like "1 …

java android string android-edittext bigdecimal