com.pivotal.gemfirexd.internal.client.am

## Class Decimal

- java.lang.Object
- - com.pivotal.gemfirexd.internal.client.am.Decimal

    public class Decimal
    extends Object

Converters from fixed point decimal bytes to `java.math.BigDecimal`, `double`, or `long`.

### Field Summary

Fields
`static int` `PACKED_DECIMAL` Packed Decimal representation

### Method Summary

Methods
`static int` `bigDecimalToPackedDecimalBytes(byte[] buffer, int offset, BigDecimal b, int declaredPrecision, int declaredScale, String columnName)` Write a Java `java.math.BigDecimal` to packed decimal bytes.
`static BigDecimal` `getBigDecimal(byte[] buffer, int offset, int precision, int scale)` Build a `java.math.BigDecimal` from a fixed point decimal byte representation.
`static double` `getDouble(byte[] buffer, int offset, int precision, int scale)` Build a Java `double` from a fixed point decimal byte representation.
`static long` `getLong(byte[] buffer, int offset, int precision, int scale)` Build a Java `long` from a fixed point decimal byte representation.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### PACKED_DECIMAL

    public static final int PACKED_DECIMAL

Packed Decimal representation

See Also:
  Constant Field Values

### Method Detail

#### getBigDecimal

    public static final BigDecimal getBigDecimal(byte[] buffer,
                           int offset,
                           int precision,
                           int scale)
                                          throws UnsupportedEncodingException

Build a `java.math.BigDecimal` from a fixed point decimal byte representation.

Throws:
  `IllegalArgumentException` - if the specified representation is not recognized.
  `UnsupportedEncodingException`

#### getDouble

    public static final double getDouble(byte[] buffer,
                   int offset,
                   int precision,
                   int scale)
                                  throws UnsupportedEncodingException

Build a Java `double` from a fixed point decimal byte representation.

Throws:
  `IllegalArgumentException` - if the specified representation is not recognized.
  `UnsupportedEncodingException`

#### getLong

    public static final long getLong(byte[] buffer,
               int offset,
               int precision,
               int scale)
                              throws UnsupportedEncodingException

Build a Java `long` from a fixed point decimal byte representation.

Throws:
  `IllegalArgumentException` - if the specified representation is not recognized.
  `UnsupportedEncodingException`

#### bigDecimalToPackedDecimalBytes

    public static final int bigDecimalToPackedDecimalBytes(byte[] buffer,
                                     int offset,
                                     BigDecimal b,
                                     int declaredPrecision,
                                     int declaredScale,
                                     String columnName)
                                                    throws SqlException

Write a Java `java.math.BigDecimal` to packed decimal bytes.

Throws:
  `SqlException`