Top "Bigdecimal" questions

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

Convert double to BigDecimal and set BigDecimal Precision

In Java, I want to take a double value and convert it to a BigDecimal and print out its String …

java double bigdecimal
Addition for BigDecimal

I want to do some simple sums with some currency values expressed in BigDecimal type. BigDecimal test = new BigDecimal(0); System.…

java bigdecimal
How can I parse a String to BigDecimal?

I have this String: 10,692,467,440,017.120 (it's an amount). I want to parse it to a BigDecimal. The problem is that I …

java string parsing bigdecimal decimalformat
Rounding BigDecimal to *always* have two decimal places

I'm trying to round BigDecimal values up, to two decimal places. I'm using BigDecimal rounded = value.round(new MathContext(2, RoundingMode.…

java math bigdecimal rounding
BigDecimal setScale and round

What is the difference between this two call? (Is there any?) // 1. new BigDecimal("3.53456").round(new MathContext(4, RoundingMode.HALF_UP)); // 2. new …

java bigdecimal
How to print formatted BigDecimal values?

I have a BigDecimal field amount which represents money, and I need to print its value in the browser in …

java formatting bigdecimal number-formatting
Java BigDecimal: Round to the nearest whole value

I need the following results 100.12 -> 100.00 100.44 -> 100.00 100.50 -> 101.00 100.75 -> 101.00 .round() or .setScale() ? How do I go …

java rounding bigdecimal
Format a BigDecimal as String with max 2 decimal digits, removing 0 on decimal part

I have a BigDecimal number and i consider only 2 decimal places of it so i truncate it using: bd = bd.…

java formatting bigdecimal
How to use comparison operators like >, =, < on BigDecimal

I have a domain class with unitPrice set as BigDecimal data type. Now I am trying to create a method …

java operator-keyword bigdecimal
How to set thousands separator in Java?

How to set thousands separator in Java? I have String representation of a BigDecimal that I want to format with …

java number-formatting bigdecimal