stripTrailingZeroes « bigdecimal « Java Data Type Q&A

Home
Java Data Type Q&A
1.bigdecimal
2.biginteger
3.bit
4.Boolean
5.byte
6.Calendar
7.cast
8.character
9.Date Time
10.Date Time Format
11.decimal
12.Development
13.double
14.enum
15.float
16.hexadecimal
17.Integer
18.Number
19.Number Format
20.primitive
21.SimpleDateFormat
22.string
23.StringBuffer
24.StringBuilder
25.StringTokenizer
26.substring
27.TimeZone
Java Data Type Q&A » bigdecimal » stripTrailingZeroes 

1. Clarification on behavior of BigDecimal.stripTrailingZeroes()    stackoverflow.com

Why the following code prints 0.00 and not 0?

BigDecimal big = new BigDecimal("0.00");
big = big.stripTrailingZeros();
System.out.println(big.toPlainString());
The following is the documentation for stripTrailingZeroes:
Returns BigDecimal which is numerically equal to this one but with ...

2. Bug in BigDecimal.stripTrailingZeroes()?    forums.oracle.com

I've noticed that the stripTrailingZeroes() method of BigDecimal has no effect if the value is zero. I had a number with a value of "0.000000000", and I expected to get just "0" back, but the number I got back was the same as the number I started with. It works fine with any other number, just not zero itself. I can't ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.