public final class DecimalData
extends java.lang.Object
All the converter routines require the precision of the decimal value to convert, which represents the number of decimal digits in the decimal value, not including the sign.
Unicode Decimal values can be represented as either a char array or as a byte array where every Unicode character is represented by a pair of adjacent bytes.
For embedded sign nibbles (4 bit integers representing values between 0x0
and 0xF
inclusive) in External Decimal or Packed Decimal data, 0xB
and 0xD
represent a negative
sign. All other sign nibble values represent a positive sign. For operations that produce an External Decimal or
Packed Decimal result, the Data Access Accelerator library inserts the preferred positive sign code of
0xC
if the result is positive, and a preferred negative sign code of 0xD
if the result is
negative. All values between 0x0
and 0xF
inclusive are interpreted as valid sign codes.
This library has full support for signed integers but only limited support for scale points (decimals). Scale points and other unrecognized characters found in input External, Unicode, or Packed Decimal byte arrays are not supported, and may cause IllegalArgumentExceptions or undefined results. BigDecimal inputs will have scale ignored (i.e. -1.23 will be interpreted as -123). When converting to BigDecimal (as output), a scale value may be explicitly specified as a separate parameter.
Modifier and Type | Field and Description |
---|---|
static int |
EBCDIC_SIGN_EMBEDDED_LEADING
External Decimal data format where each byte is an EBCDIC character representing a decimal digit, the sign is
encoded in the top nibble of the first byte.
|
static int |
EBCDIC_SIGN_EMBEDDED_TRAILING
External Decimal data format where each byte is an EBCDIC character representing a decimal digit, the sign is
encoded in the top nibble of the last byte.
|
static int |
EBCDIC_SIGN_SEPARATE_LEADING
External Decimal data format where each byte is an EBCDIC character representing a decimal digit, the sign is
encoded in a separate byte that comes before the first byte of the number.
|
static int |
EBCDIC_SIGN_SEPARATE_TRAILING
External Decimal data format where each byte is an EBCDIC character representing a decimal digit, the sign is
encoded in a separate byte that comes after the last byte of the number.
|
static int |
UNICODE_SIGN_SEPARATE_LEADING
Unicode Decimal data format where each digit is a Unicode character, the sign is stored in the first character.
|
static int |
UNICODE_SIGN_SEPARATE_TRAILING
Unicode Decimal data format where each digit is a Unicode character, the sign is stored in the last character.
|
static int |
UNICODE_UNSIGNED
Unicode Decimal data format where each digit is a Unicode character, there is no sign.
|
Modifier and Type | Method and Description |
---|---|
static void |
convertBigDecimalToExternalDecimal(java.math.BigDecimal bigDecimalValue,
byte[] externalDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts a BigDecimal value to an External Decimal in a byte array
Overflow can happen if the BigDecimal does not fit into the result byte array.
|
static void |
convertBigDecimalToPackedDecimal(java.math.BigDecimal bigDecimalValue,
byte[] packedDecimal,
int offset,
int precision,
boolean checkOverflow)
Converts a BigDecimal into a Packed Decimal in a byte array
Overflow can happen if the BigDecimal does not fit into the result byte array.
|
static void |
convertBigDecimalToUnicodeDecimal(java.math.BigDecimal bigDecimalValue,
char[] unicodeDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts a BigDecimal value to a Unicode Decimal in a char array
Overflow can happen if the BigDecimal does not fit into the result char array.
|
static void |
convertBigIntegerToExternalDecimal(java.math.BigInteger bigIntegerValue,
byte[] externalDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts a BigInteger value into an External Decimal in a byte array
Overflow can happen if the BigInteger does not fit into the byte array.
|
static void |
convertBigIntegerToPackedDecimal(java.math.BigInteger bigIntegerValue,
byte[] packedDecimal,
int offset,
int precision,
boolean checkOverflow)
Converts a BigInteger value into a Packed Decimal in a byte array
Overflow can happen if the BigInteger does not fit into the byte array.
|
static void |
convertBigIntegerToUnicodeDecimal(java.math.BigInteger bigIntegerValue,
char[] unicodeDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts a BigInteger value to a Unicode Decimal in a char array
Overflow can happen if the BigInteger does not fit into the char array.
|
static java.math.BigDecimal |
convertExternalDecimalToBigDecimal(byte[] externalDecimal,
int offset,
int precision,
int scale,
boolean checkOverflow,
int decimalType)
Converts an External Decimal in a byte array to a BigDecimal.
|
static java.math.BigInteger |
convertExternalDecimalToBigInteger(byte[] externalDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Convert an External Decimal in a byte array to a BigInteger.
|
static int |
convertExternalDecimalToInteger(byte[] externalDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts an External Decimal value in a byte array into a binary integer.
|
static long |
convertExternalDecimalToLong(byte[] externalDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts an External Decimal value in a byte array into a long.
|
static void |
convertExternalDecimalToPackedDecimal(byte[] externalDecimal,
int externalOffset,
byte[] packedDecimal,
int packedOffset,
int precision,
int decimalType)
Converts an External Decimal in a byte array to a Packed Decimal in another byte array.
|
static void |
convertIntegerToExternalDecimal(int integerValue,
byte[] externalDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts an integer to an External Decimal in a byte array.
|
static void |
convertIntegerToPackedDecimal(int integerValue,
byte[] packedDecimal,
int offset,
int precision,
boolean checkOverflow)
Converts a binary integer value into a signed Packed Decimal format.
|
static void |
convertIntegerToUnicodeDecimal(int integerValue,
char[] unicodeDecimal,
int offset,
int precision,
boolean checkoverflow,
int unicodeType)
Converts an integer to a Unicode Decimal in a char array
Overflow can happen if the resulting External Decimal value does not fit into the char array, given the offset and
precision.
|
static void |
convertLongToExternalDecimal(long longValue,
byte[] externalDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts a long into an External Decimal in a byte array.
|
static void |
convertLongToPackedDecimal(long longValue,
byte[] packedDecimal,
int offset,
int precision,
boolean checkOverflow)
Converts a binary long value into signed Packed Decimal format.
|
static void |
convertLongToUnicodeDecimal(long longValue,
char[] unicodeDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Converts a long to a Unicode Decimal in a char array
Overflow can happen if the resulting Unicode Decimal value does not fit into the char array, given its precision
and offset .
|
static java.math.BigDecimal |
convertPackedDecimalToBigDecimal(byte[] packedDecimal,
int offset,
int precision,
int scale,
boolean checkOverflow)
Convert a Packed Decimal in a byte array to a BigDecimal.
|
static java.math.BigInteger |
convertPackedDecimalToBigInteger(byte[] packedDecimal,
int offset,
int precision,
boolean checkOverflow)
Convert a Packed Decimal in a byte array to a BigInteger.
|
static void |
convertPackedDecimalToExternalDecimal(byte[] packedDecimal,
int packedOffset,
byte[] externalDecimal,
int externalOffset,
int precision,
int decimalType)
Converts a Packed Decimal in a byte array into an External Decimal in another byte array.
|
static int |
convertPackedDecimalToInteger(byte[] packedDecimal,
int offset,
int precision,
boolean checkOverflow)
Converts a Packed Decimal value in a byte array into a binary integer.
|
static long |
convertPackedDecimalToLong(byte[] packedDecimal,
int offset,
int precision,
boolean checkOverflow)
Converts a Packed Decimal value in a byte array into a binary long.
|
static void |
convertPackedDecimalToUnicodeDecimal(byte[] packedDecimal,
int packedOffset,
char[] unicodeDecimal,
int unicodeOffset,
int precision,
int decimalType)
Convert a Packed Decimal in a byte array to a Unicode Decimal in a char array.
|
static java.math.BigDecimal |
convertUnicodeDecimalToBigDecimal(char[] unicodeDecimal,
int offset,
int precision,
int scale,
boolean checkOverflow,
int decimalType)
Converts a Unicode Decimal in a char array to a BigDecimal.
|
static java.math.BigInteger |
convertUnicodeDecimalToBigInteger(char[] unicodeDecimal,
int offset,
int precision,
boolean checkOverflow,
int decimalType)
Convert a Unicode Decimal in a char array to a BigInteger.
|
static int |
convertUnicodeDecimalToInteger(char[] unicodeDecimal,
int offset,
int precision,
boolean checkOverflow,
int unicodeType)
Converts a Unicode Decimal value in a char array into a binary integer.
|
static long |
convertUnicodeDecimalToLong(char[] unicodeDecimal,
int offset,
int precision,
boolean checkOverflow,
int unicodeType)
Converts a Unicode Decimal value in a char array into a binary long.
|
static void |
convertUnicodeDecimalToPackedDecimal(char[] unicodeDecimal,
int unicodeOffset,
byte[] packedDecimal,
int packedOffset,
int precision,
int decimalType)
Converts an Unicode Decimal in a char array to a Packed Decimal in a byte array.
|
public static final int EBCDIC_SIGN_EMBEDDED_TRAILING
public static final int EBCDIC_SIGN_EMBEDDED_LEADING
public static final int EBCDIC_SIGN_SEPARATE_TRAILING
public static final int EBCDIC_SIGN_SEPARATE_LEADING
public static final int UNICODE_UNSIGNED
public static final int UNICODE_SIGN_SEPARATE_LEADING
public static final int UNICODE_SIGN_SEPARATE_TRAILING
public static void convertIntegerToPackedDecimal(int integerValue, byte[] packedDecimal, int offset, int precision, boolean checkOverflow)
checkOverflow
is true an ArithmeticException
is thrown,
when false a truncated or invalid result is returned.integerValue
- the binary integer value to convertpackedDecimal
- byte array that will store the resulting Packed Decimal valueoffset
- offset of the first byte of the Packed Decimal in packedDecimal
precision
- number of Packed Decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)java.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if packedDecimal
is nulljava.lang.ArithmeticException
- if the checkOverflow
parameter is true and overflow occurspublic static void convertIntegerToExternalDecimal(int integerValue, byte[] externalDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown,
when false a truncated or invalid result is returned.integerValue
- the value to convertexternalDecimal
- the byte array which will hold the External Decimal on a successful returnoffset
- the offset in the byte array at which the External Decimal should be locatedprecision
- the number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the designated array cannot hold the
External Decimal.decimalType
- constant value indicating the type of External Decimaljava.lang.NullPointerException
- if externalDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if the checkOverflow
parameter is true and overflow occursjava.lang.IllegalArgumentException
- if decimalType
or precision
is invalidpublic static void convertIntegerToUnicodeDecimal(int integerValue, char[] unicodeDecimal, int offset, int precision, boolean checkoverflow, int unicodeType)
checkOverflow
is true an ArithmeticException
is thrown,
when false a truncated or invalid result is returned.integerValue
- the long value to convertunicodeDecimal
- the char array which will hold the Unicode Decimal on a successful returnoffset
- the offset in the char array where the Unicode Decimal would be locatedprecision
- the number of decimal digits. Maximum valid precision is 253checkoverflow
- if true, when the designated an ArithmeticException
unicodeType
- constant value indicating the type of Unicode Decimaljava.lang.NullPointerException
- if unicodeDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if the checkOverflow
parameter is true and overflow occursjava.lang.IllegalArgumentException
- if the decimalType
or precision
is invalidpublic static void convertLongToPackedDecimal(long longValue, byte[] packedDecimal, int offset, int precision, boolean checkOverflow)
checkOverflow
is true an ArithmeticException
is thrown,
when false a truncated or invalid result is returned.longValue
- the binary long value to convertpackedDecimal
- byte array that will store the resulting Packed Decimal valueoffset
- offset of the first byte of the Packed Decimal in packedDecimal
precision
- number of Packed Decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow), otherwise a truncated value is returnedjava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if packedDecimal
is nulljava.lang.ArithmeticException
- the checkOverflow
parameter is true and overflow occurspublic static void convertLongToExternalDecimal(long longValue, byte[] externalDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown, when false a
truncated or invalid result is returned.longValue
- the value to convertexternalDecimal
- the byte array which will hold the External Decimal on a successful returnoffset
- the offset into externalDecimal
where External Decimal should be locatedprecision
- the number of decimal digits to convert. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
or IllegalArgumentException
may be throwndecimalType
- constant value indicating the type of External Decimaljava.lang.NullPointerException
- if externalDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if the checkOverflow
parameter is true and overflow occursjava.lang.IllegalArgumentException
- if the decimalType
or precision
is invalidpublic static void convertLongToUnicodeDecimal(long longValue, char[] unicodeDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown,
when false a truncated or invalid result is returned.longValue
- the long value to convertunicodeDecimal
- the char array which will hold the Unicode Decimal on a successful returnoffset
- the offset in the char array where the Unicode Decimal would be locatedprecision
- the number of Unicode Decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
or IllegalArgumentException
may be throwndecimalType
- constant value indicating the type of External Decimaljava.lang.NullPointerException
- if unicodeDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if the checkOverflow
parameter is true and overflow occursjava.lang.IllegalArgumentException
- if decimalType
or precision
is invalidpublic static int convertPackedDecimalToInteger(byte[] packedDecimal, int offset, int precision, boolean checkOverflow)
checkOverflow
is true overflow results in an ArithmeticException
, when false a
truncated or invalid result is returned.packedDecimal
- byte array which contains the Packed Decimal valueoffset
- offset of the first byte of the Packed Decimal in packedDecimal
precision
- number of Packed Decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
may be thrownjava.lang.NullPointerException
- if packedDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result does not fit into an int (overflow)public static long convertPackedDecimalToLong(byte[] packedDecimal, int offset, int precision, boolean checkOverflow)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.packedDecimal
- byte array which contains the Packed Decimal valueoffset
- offset of the first byte of the Packed Decimal in packedDecimal
precision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
may be thrownjava.lang.NullPointerException
- if packedDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result does not fit into a long (overflow)public static void convertPackedDecimalToExternalDecimal(byte[] packedDecimal, int packedOffset, byte[] externalDecimal, int externalOffset, int precision, int decimalType)
packedDecimal
- byte array that holds the Packed Decimal to be convertedpackedOffset
- offset in packedDecimal
where the Packed Decimal is locatedexternalDecimal
- byte array that will hold the External Decimal on a successful returnexternalOffset
- offset in externalOffset
where the External Decimal is expected to be locatedprecision
- number of decimal digitsdecimalType
- constant indicating the type of the decimaljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if packedDecimal
or externalDecimal
are nulljava.lang.IllegalArgumentException
- if precision
or decimalType
is invalidpublic static void convertPackedDecimalToUnicodeDecimal(byte[] packedDecimal, int packedOffset, char[] unicodeDecimal, int unicodeOffset, int precision, int decimalType)
packedDecimal
- byte array that holds a Packed Decimal to be convertedpackedOffset
- offset in packedDecimal
where the Packed Decimal is locatedunicodeDecimal
- char array that will hold the Unicode Decimal on a successful returnunicodeOffset
- offset in the byte array where the Unicode Decimal is expected to be locatedprecision
- number of decimal digitsdecimalType
- constant value indicating the type of the External Decimaljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if packedDecimal
or unicodeDecimal
are nulljava.lang.IllegalArgumentException
- if precision
or decimalType
is invalidpublic static java.math.BigInteger convertPackedDecimalToBigInteger(byte[] packedDecimal, int offset, int precision, boolean checkOverflow)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.packedDecimal
- byte array that holds the Packed Decimal to be convertedoffset
- offset in packedDecimal
where the Packed Decimal is locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)java.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if packedDecimal
is nullpublic static java.math.BigDecimal convertPackedDecimalToBigDecimal(byte[] packedDecimal, int offset, int precision, int scale, boolean checkOverflow)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.packedDecimal
- byte array that holds the Packed Decimal to be convertedoffset
- offset in packedDecimal
where the Packed Decimal is locatedprecision
- number of decimal digits. Maximum valid precision is 253scale
- scale of the BigDecimal to be returnedcheckOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)java.lang.NullPointerException
- if packedDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- /requires rounding if an invalid array access occurspublic static int convertExternalDecimalToInteger(byte[] externalDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
decimalType
) contains one of the negative sign codes, in which case the sign of the input External
Decimal is interpreted as negative.
Overflow can happen if the External Decimal value does not fit into a binary integer. In this case, when
checkOverflow
is true an ArithmeticException
is thrown, when false the resulting number
will be wrapped around starting at the minimum/maximum possible integer value.externalDecimal
- byte array which contains the External Decimal valueoffset
- the offset where the External Decimal value is locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
or IllegalArgumentException
may be thrown. If
false and there is an overflow, the result is undefined.decimalType
- constant value indicating the type of External Decimaljava.lang.NullPointerException
- if externalDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result does not fit into a int (overflow)java.lang.IllegalArgumentException
- if precision
or decimalType
is invalidpublic static long convertExternalDecimalToLong(byte[] externalDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
decimalType
) contains one of
the negative sign codes, in which case the sign of the input External Decimal is interpreted as negative.
Overflow can happen if the External Decimal value does not fit into a binary long. When
checkOverflow
is true overflow results in an ArithmeticException
, when false the
resulting number will be wrapped around starting at the minimum/maximum possible long value.externalDecimal
- byte array which contains the External Decimal valueoffset
- offset of the first byte of the Packed Decimal in the externalDecimal
precision
- number of External Decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown when the converted value cannot fit into
designated External Decimal array. If false and there is an overflow, the result is undefined.decimalType
- constant value indicating the type of External Decimaljava.lang.NullPointerException
- if externalDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result does not fit into a long (overflow)java.lang.IllegalArgumentException
- if precision
or decimalType
is invalidpublic static void convertExternalDecimalToPackedDecimal(byte[] externalDecimal, int externalOffset, byte[] packedDecimal, int packedOffset, int precision, int decimalType)
decimalType
) contains one of the negative sign codes, in which case the sign of the input External
Decimal is interpreted as negative.externalDecimal
- byte array holding the External Decimal to be convertedexternalOffset
- offset in externalDecimal
where the External Decimal is locatedpackedDecimal
- byte array which will hold the Packed Decimal on a successful returnpackedOffset
- offset in packedDecimal
where the Packed Decimal is expected to be locatedprecision
- the number of decimal digitsdecimalType
- constant value indicating the type of External Decimaljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if packedDecimal
or externalDecimal
is nulljava.lang.IllegalArgumentException
- if precision
or decimalType
is invalidpublic static java.math.BigInteger convertExternalDecimalToBigInteger(byte[] externalDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
decimalType
) contains one of the
negative sign codes, in which case the sign of the input External Decimal is interpreted as negative.
Overflow can happen if the External Decimal value does not fit into the BigInteger. In this case, when
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.externalDecimal
- byte array that holds the Packed Decimal to be convertedoffset
- offset in externalDecimal
where the Packed Decimal is locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)decimalType
- constant value indicating the type of External Decimaljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if externalDecimal
is nulljava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowsjava.lang.IllegalArgumentException
- if decimalType
or precision
is invalid, or the digital part of the input is
invalid.public static java.math.BigDecimal convertExternalDecimalToBigDecimal(byte[] externalDecimal, int offset, int precision, int scale, boolean checkOverflow, int decimalType)
decimalType
) contains one of the
negative sign codes, in which case the sign of the input External Decimal is interpreted as negative.
Overflow can happen if the External Decimal value does not fit into the BigDecimal. In this case, when
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.externalDecimal
- byte array holding the External Decimal to be convertedoffset
- offset in externalDecimal
where the External Decimal is locatedprecision
- number of decimal digits. Maximum valid precision is 253scale
- scale of the BigDecimalcheckOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)decimalType
- constant value that indicates the type of External Decimaljava.lang.NullPointerException
- if externalDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowsjava.lang.IllegalArgumentException
- if checkOverflow
is true and the Packed Decimal is in an invalid format, or the digital
part of the input is invalid.public static int convertUnicodeDecimalToInteger(char[] unicodeDecimal, int offset, int precision, boolean checkOverflow, int unicodeType)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.unicodeDecimal
- char array which contains the Unicode Decimal valueoffset
- the offset where the Unicode Decimal value is locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
or IllegalArgumentException
may be thrownunicodeType
- constant value indicating the type of External Decimaljava.lang.NullPointerException
- if unicodeDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result does not fit into a long (overflow)java.lang.IllegalArgumentException
- if precision
or decimalType
is invalid, or the digital part of the input is
invalid.public static long convertUnicodeDecimalToLong(char[] unicodeDecimal, int offset, int precision, boolean checkOverflow, int unicodeType)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.unicodeDecimal
- char array which contains the External Decimal valueoffset
- offset of the first byte of the Unicode Decimal in unicodeDecimal
precision
- number of Unicode Decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown whenunicodeType
- constant value indicating the type of External Decimaljava.lang.NullPointerException
- if unicodeDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result does not fit into a long (overflow)java.lang.IllegalArgumentException
- if unicodeType
or precision
is invalid, or the digital part of the input is
invalid.public static void convertUnicodeDecimalToPackedDecimal(char[] unicodeDecimal, int unicodeOffset, byte[] packedDecimal, int packedOffset, int precision, int decimalType)
unicodeDecimal
- char array that holds the Unicode Decimal to be convertedunicodeOffset
- offset in unicodeDecimal
at which the Unicode Decimal is locatedpackedDecimal
- byte array that will hold the Packed Decimal on a successful returnpackedOffset
- offset in packedDecimal
where the Packed Decimal is expected to be locatedprecision
- number of decimal digitsdecimalType
- constant value indicating the type of External Decimaljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if packedDecimal
or unicodeDecimal
are nulljava.lang.IllegalArgumentException
- if precision
or decimalType
is invalidpublic static java.math.BigInteger convertUnicodeDecimalToBigInteger(char[] unicodeDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.unicodeDecimal
- char array that holds the Packed Decimal to be convertedoffset
- offset into unicodeDecimal
where the Packed Decimal is locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)decimalType
- constant value indicating the type of External Decimaljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.NullPointerException
- if unicodeDecimal
is nulljava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowsjava.lang.IllegalArgumentException
- if decimalType
or precision
is invalid, or the digital part of the input is
invalid.public static java.math.BigDecimal convertUnicodeDecimalToBigDecimal(char[] unicodeDecimal, int offset, int precision, int scale, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.unicodeDecimal
- char array that holds the Unicode Decimaloffset
- offset in unicodeDecimal
where the Unicode Decimal is locatedprecision
- number of decimal digits. Maximum valid precision is 253scale
- scale of the returned BigDecimalcheckOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)decimalType
- constant value indicating the type of External Decimaljava.lang.NullPointerException
- if unicodeDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowsjava.lang.IllegalArgumentException
- if checkOverflow
is true and the Packed Decimal is in an invalid format, or the digital
part of the input is invalid.public static void convertBigIntegerToPackedDecimal(java.math.BigInteger bigIntegerValue, byte[] packedDecimal, int offset, int precision, boolean checkOverflow)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.bigIntegerValue
- BigInteger value to be convertedpackedDecimal
- byte array which will hold the Packed Decimal on a successful returnoffset
- offset into packedDecimal
where the Packed Decimal is expected to be locatedprecision
- number of decimal digits. Maximum valid precision is 253scheckOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)java.lang.NullPointerException
- if packedDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowspublic static void convertBigIntegerToExternalDecimal(java.math.BigInteger bigIntegerValue, byte[] externalDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.bigIntegerValue
- BigInteger value to be convertedexternalDecimal
- byte array which will hold the External Decimal on a successful returnoffset
- offset into externalDecimal
where the External Decimal is expected to be locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)decimalType
- constant value that indicates the type of External Decimaljava.lang.NullPointerException
- if externalDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowsjava.lang.IllegalArgumentException
- if decimalType
or precision
is invalidpublic static void convertBigIntegerToUnicodeDecimal(java.math.BigInteger bigIntegerValue, char[] unicodeDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.bigIntegerValue
- BigInteger value to be convertedunicodeDecimal
- char array that will hold the Unicode decimal on a successful returnoffset
- offset into unicodeDecimal
where the Unicode Decimal is expected to be locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)decimalType
- constant indicating the type of External Decimaljava.lang.NullPointerException
- if unicodeDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowsjava.lang.IllegalArgumentException
- if decimalType
or precision
is invalidpublic static void convertBigDecimalToPackedDecimal(java.math.BigDecimal bigDecimalValue, byte[] packedDecimal, int offset, int precision, boolean checkOverflow)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.bigDecimalValue
- the BigDecimal value to be convertedpackedDecimal
- byte array which will hold the Packed Decimal on a successful returnoffset
- desired offset in packedDecimal
where the Packed Decimal is expected to be locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)java.lang.NullPointerException
- if packedDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowspublic static void convertBigDecimalToExternalDecimal(java.math.BigDecimal bigDecimalValue, byte[] externalDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.bigDecimalValue
- BigDecimal value to be convertedexternalDecimal
- byte array that will hold the External Decimal on a successful returnoffset
- offset in externalDecimal
where the External Decimal is expected to be locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)decimalType
- constant value indicating the External Decimal typejava.lang.NullPointerException
- if externalDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowsjava.lang.IllegalArgumentException
- if precision
or decimalType
is invalidpublic static void convertBigDecimalToUnicodeDecimal(java.math.BigDecimal bigDecimalValue, char[] unicodeDecimal, int offset, int precision, boolean checkOverflow, int decimalType)
checkOverflow
is true an ArithmeticException
is thrown, when false a truncated or
invalid result is returned.bigDecimalValue
- BigDecimal value to be convertedunicodeDecimal
- char array which will hold the Unicode Decimal on a successful returnoffset
- offset in unicodeDecimal
where the Unicode Decimal is expected to be locatedprecision
- number of decimal digits. Maximum valid precision is 253checkOverflow
- if true an ArithmeticException
will be thrown if the decimal value does not fit in the
specified precision (overflow)decimalType
- constant value that indicates the type of External Decimaljava.lang.NullPointerException
- if unicodeDecimal
is nulljava.lang.ArrayIndexOutOfBoundsException
- if an invalid array access occursjava.lang.ArithmeticException
- if checkOverflow
is true and the result overflowsjava.lang.IllegalArgumentException
- if decimalType
or precision
is invalidEclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 2013, 2025 IBM Corp. and others.