Class JavaBigDecimalFromByteArray

    • Constructor Detail

      • JavaBigDecimalFromByteArray

        public JavaBigDecimalFromByteArray()
        Creates a new instance.
    • Method Detail

      • parseBigDecimalString

        public java.math.BigDecimal parseBigDecimalString​(byte[] str,
                                                          int offset,
                                                          int length)
        Parses a BigDecimalString as specified in JavaBigDecimalParser.
        Parameters:
        str - the input string
        offset - start of the input data
        length - length of the input data
        Returns:
        the parsed BigDecimal
        Throws:
        java.lang.NullPointerException - if str is null
        java.lang.IllegalArgumentException - if offset or length are illegal
        java.lang.NumberFormatException - if the input string can not be parsed successfully
      • parseBigDecimalStringWithManyDigits

        java.math.BigDecimal parseBigDecimalStringWithManyDigits​(byte[] str,
                                                                 int offset,
                                                                 int length)
        Parses a big decimal string that has many digits.
      • valueOfBigDecimalString

        java.math.BigDecimal valueOfBigDecimalString​(byte[] str,
                                                     int integerPartIndex,
                                                     int decimalPointIndex,
                                                     int nonZeroFractionalPartIndex,
                                                     int exponentIndicatorIndex,
                                                     boolean isNegative,
                                                     int exponent)
        Parses a big decimal string after we have identified the parts of the significand, and after we have obtained the exponent value.
               integerPartIndex
               │  decimalPointIndex
               │  │  nonZeroFractionalPartIndex
               │  │  │  exponentIndicatorIndex
               ↓  ↓  ↓  ↓
             "-123.00456e-789"
        
         
        Parameters:
        str - the input string
        integerPartIndex - the start index of the integer part of the significand
        decimalPointIndex - the index of the decimal point in the significand (same as exponentIndicatorIndex if there is no decimal point)
        nonZeroFractionalPartIndex - the start index of the non-zero fractional part of the significand
        exponentIndicatorIndex - the index of the exponent indicator (same as end of string if there is no exponent indicator)
        isNegative - indicates that the significand is negative
        exponent - the exponent value
        Returns:
        the parsed big decimal