Java bigdecimal class comes under java.math library. Class
bigdecimal enhances the users limitation over rounding action on
numbers by providing a set of eight rounding modes such as ROUND_CEILING,
ROUND_DOWN, ROUND_FLOOR, etc.
Calculations done by programs on integer, rational & decimal numbers using bigdecimal class, is performed through a technique known as arbitrary-precision process in which an undetermined number of digits of precision, are involved (precision of digits of the number is often confined to the host's system memory).
BigDecimal class provides opportunity to perform several operations such as mathematical addition, subtraction, multiplication and division.
By the availability of a set of eight rounding modes, user's control on applying rounding feature is increased. Others features like analyzing (comparison), format alteration (change), hashing and authorization on setting scales have increased the usage of this class in building Business applications.
Java bigdecimal class objects can be used in holding decimal values of 16(sixteen) significant digits precisely. Example below shows how to get start working with bigdecimal class. In the code First a class object is created and than a String argument is passed. This String argument in double quotes inside the bigdecimal class constructor concludes the value of the object.
The bigdecimal class is designed to solve two types of problems that are associated with floating-point numbers. First, the bigdecimal class can be used to exactly represent decimal numbers. Second, it can be used to work with numbers that have more than 16 significant digits. If you haven't ever used this class, it's one that you should master and use for many business applications.
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: November 21, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles