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 ...

Get PURE Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.