Class JavaBigDecimalFromCharSequence


final class JavaBigDecimalFromCharSequence extends AbstractBigDecimalParser
Parses a double from a byte array.
  • Constructor Details

    • JavaBigDecimalFromCharSequence

      public JavaBigDecimalFromCharSequence()
      Creates a new instance.
  • Method Details

    • parseBigDecimalString

      public BigDecimal parseBigDecimalString(CharSequence 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:
      NullPointerException - if str is null
      IllegalArgumentException - if offset or length are illegal
      NumberFormatException - if the input string can not be parsed successfully
    • parseBigDecimalStringWithManyDigits

      BigDecimal parseBigDecimalStringWithManyDigits(CharSequence str, int offset, int length)
      Parses a big decimal string that has many digits.
    • valueOfBigDecimalString

      BigDecimal valueOfBigDecimalString(CharSequence 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