public class DecimalField extends Object
DecimalField class is a utility to convert
 java.math.BigDecimal values to String 
 values that are lexicographically sortable according to the decimal value.
 The string format uses the characters '0' to '9' and consists of:
 { value signum +2 }
 { exponent signum +2 }
 { exponent length -1 }
 { exponent value }
 { value (-1 if inverted) }
 
 Only the signum is encoded if the value is zero. The exponent is not
 encoded if zero. Negative values are "inverted" character by character
 ('0' -> 9, '1' -> '8', and so on). The same applies to the exponent.
 Examples: 0 => "2" 2 => "322" (signum 1; exponent 0; value 2) 120 => "330212" (signum 1; exponent signum 1, length 1, value 2; value 12). -1 => "179" (signum -1, rest inverted; exponent 0; value 1 (-1, inverted).
Values between BigDecimal(BigInteger.ONE, Integer.MIN_VALUE) and BigDecimal(BigInteger.ONE, Integer.MAX_VALUE) are supported.
| Constructor and Description | 
|---|
DecimalField()  | 
| Modifier and Type | Method and Description | 
|---|---|
static String | 
decimalToString(BigDecimal value)
Convert a BigDecimal to a String. 
 | 
static BigDecimal | 
stringToDecimal(String value)
Convert a String to a BigDecimal. 
 | 
public static String decimalToString(BigDecimal value)
value - the BigDecimalpublic static BigDecimal stringToDecimal(String value)
value - the StringCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.