code: public final BigDecimal getDecimal(final int pos, final int precision, final int scale) {
          final int intg = precision - scale;
          final int frac = scale;
          final int intg0 = intg / DIG_PER_INT32;
          final int frac0 = frac / DIG_PER_INT32;
          final int intg0x = intg - intg0 * DIG_PER_INT32;
          final int frac0x = frac - frac0 * DIG_PER_INT32;
  
          final int binSize = intg0 * SIZE_OF_INT32 + dig2bytes[intg0x] + frac0 * SIZE_OF_INT32 + dig2bytes[frac0x];
          if (pos + binSize > limit || pos < 0) {
              throw new IllegalArgumentException("limit excceed: " + (pos < 0 ? pos : (pos + binSize)));
          }
          return getDecimal0(origin + pos, intg, frac, // NL
              intg0,
              frac0,
              intg0x,
              frac0x);
      }
docs: Return big decimal from buffer.
  
  @see mysql-5.1.60/strings/decimal.c - bin2decimal()