Constants for One, Ten and Zero
static BigDecimal ONE
- The value 1, with a scale of 0.
static BigDecimal TEN
- The value 10, with a scale of 0.
static BigDecimal ZERO
- The value 0, with a scale of 0.
import java.math.BigDecimal;
public class Main {
public static void main(String[] args) {
System.out.println(BigDecimal.ONE);
System.out.println(BigDecimal.TEN);
System.out.println(BigDecimal.ZERO);
}
}
The output:
1
10
0
Home
Java Book
Essential Classes
Java Book
Essential Classes
BigDecimal:
- BigDecimal class
- Constants for One, Ten and Zero
- Rounding mode
- Create BigDecimals
- Methods used to do calculation
- Convert BigDecimal to primitive data types
- Compare two BigDecimal
- Move decimal point
- Scale and precision
- Convert BigDecimal to String
- Remove the trailing zeros
- Convert double and long to BigDecimal
- Calculating Euler's number e with BigDecimal