O'Reilly logo

PURE Java™ 2 by Kenneth Litwak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Class Details

Class BigDecimal

public class
							BigDecimal
                 extends Number
                 implements Comparable

A BigDecimal object is an immutable, arbitrary precision, signed, decimal number. A BigDecimal has two components:

  • An arbitrary precision, integer, unscaled value

  • A nonnegative 32-bit integer scale that represents the number of digits to the right of the decimal point

You can perform arithmetic on a BigDecimal, as well as scaling and rounding. You have complete control over rounding. Here is a code snippet showing the use of a BigDecimal being used with a PreparedStatement for an SQL call:

 PreparedStatement prepstmt = conn.prepareStatement ("UPDATE EMPLOYEE_TABLE ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required