To convert a long to a BigDecimal use:
// convert a long to BigDecimal, with some implied decimal places. BigDecimal d = BigDecimal.valueOf( theLong, decimalPlaces );
You can’t use ordinary arithmetic or comparison operators on BigDecimal. You must use methods like BigDecimal.add, .subtract, .multiply,. divide, .pow, .abs,.compareTo …
To convert your BigDecimal to a String for display you can use BigDecimal. toString or BigDecimal. toEngineeringString. It is also possible using Formatter and printf.
PSPDec (Prospero Software Products Decimal) is a third party library.
This page is posted |
http://mindprod.com/jgloss/bigdecimal.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\bigdecimal.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[35.170.81.33] |
| |
Feedback |
You are visitor number | |