Put a BigDecimal value out to the specified byte array position.

@param bytes  the byte array
@param offset position in the array
@param val    BigDecimal to write out
@return incremented offset
510006
public static int putBigDecimal(byte[] bytes, int offset, BigDecimal val) {
    if (bytes == null) {
      return offset;
    }

    byte[] valueBytes = val.unscaledValue().toByteArray();
    byte[] result = new byte[valueBytes.length + SIZEOF_INT];
    offset = putInt(result, offset, val.scale());
    return putBytes(result, offset, valueBytes, 0, valueBytes.length);
  }
949552
public static void writeShort(byte[] bytes, short value, int offset) {
        bytes[offset] = (byte) (0xFF & (value >> 8));
        bytes[offset + 1] = (byte) (0xFF & value);
    }
966834
public void putInt(int val) throws IOException {
    if (byteOrder == ByteOrder.BIG_ENDIAN) {
      writeIntCurrentPosition((val >>> 24) & 0xFF);
      writeIntCurrentPosition((val >>> 16) & 0xFF);
      writeIntCurrentPosition((val >>> 8) & 0xFF);
      writeIntCurrentPosition((val >>> 0) & 0xFF);
    }
    else {
      writeIntCurrentPosition((val >>> 0) & 0xFF);
      writeIntCurrentPosition((val >>> 8) & 0xFF);
      writeIntCurrentPosition((val >>> 16) & 0xFF);
      writeIntCurrentPosition((val >>> 24) & 0xFF);
    }
  }
78860
@Override
  public void put(double val) {
    if(n <= 0) {
      n = 1;
      sum = val;
      m2 = 0;
      return;
    }
    final double tmp = n * val - sum;
    final double oldn = n; // tmp copy
    n += 1.0;
    sum += val;
    m2 += tmp * tmp / (n * oldn);
  }
1133236
public static void writeBytes(byte[] bytes, long value, int offset, int numBytes) {
        int shift = 0;
        for(int i = offset + numBytes - 1; i >= offset; i--) {
            bytes[i] = (byte) (0xFF & (value >> shift));
            shift += 8;
        }
    }
644762
public static void intToBytes(int value, byte[] bytes, int offset) {
        bytes[offset + 3] = (byte) (value >>> 0);
        bytes[offset + 2] = (byte) (value >>> 8);
        bytes[offset + 1] = (byte) (value >>> 16);
        bytes[offset + 0] = (byte) (value >>> 24);
    }
5033
static public BigDecimal decodeDecimal(final ByteBuffer bb) {
        final int scale = bb.get();
        final int precisionBytes = bb.get();
        final byte[] bytes = new byte[precisionBytes];
        bb.get(bytes);
        return new BigDecimal(new BigInteger(bytes), scale);
    }
555214
public static double bytes_to_double(byte[] bytes, int offset) {
		try {
			long result = bytes[0+offset] & 0xff;
			result <<= 8;
			result |= bytes[1+offset] & 0xff;
			result <<= 8;
			result |= bytes[2+offset] & 0xff;
			result <<= 8;
			result |= bytes[3+offset] & 0xff;
			result <<= 8;
			result |= bytes[4+offset] & 0xff;
			result <<= 8;
			result |= bytes[5+offset] & 0xff;
			result <<= 8;
			result |= bytes[6+offset] & 0xff;
			result <<= 8;
			result |= bytes[7+offset] & 0xff;
			return Double.longBitsToDouble(result);
		} catch (IndexOutOfBoundsException x) {
			throw new PickleException("decoding double: too few bytes");
		}
	}
585609
public static void addBytes(ByteBuffer buffer, byte[] val, int offset, int length)
  {
    long hash64 = val == null ? Murmur3.NULL_HASHCODE :
                  Murmur3.hash64(val, offset, length);
    addHash(buffer, hash64);
  }
325945
public int setBytes(final long pos, byte[] bytes) throws SQLException {
        if (bytes == null) {
            throw new IllegalArgumentException("No byte to be set");
        } // end of if

        return setBytes(pos, bytes, 0, bytes.length);
    }
554842
public static long crc32(byte[] bytes, int offset, int size) {
        CRC32 crc = new CRC32();
        crc.update(bytes, offset, size);
        return crc.getValue();
    }
988683
public static int putBytes(byte[] tgtBytes, int tgtOffset, byte[] srcBytes,
      int srcOffset, int srcLength) {
    System.arraycopy(srcBytes, srcOffset, tgtBytes, tgtOffset, srcLength);
    return tgtOffset + srcLength;
  }
390973
public static int putDouble(byte [] bytes, int offset, double d) {
    return putLong(bytes, offset, Double.doubleToLongBits(d));
  }
475812
public static int writeUnsignedInt(byte[] bytes, int offset, int i) {
      int localOffset = offset;
      while ((i & ~0x7F) != 0) {
         bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80);
         i >>>= 7;
      }
      bytes[localOffset++] = (byte) i;
      return localOffset - offset;
   }
45716
public static short bytesToShort(byte[] bytes, int offset) {
        short result = 0x0;
        for (int i = offset; i < offset + 2; ++i) {
            result = (short) ((result) << 8);
            result |= (bytes[i] & 0x00FF);
        }
        return result;
    }
387659
public static final void writeDouble(double value, byte[] array, int offset)
    {
        writeLong(Double.doubleToRawLongBits(value), array, offset);
    }
997996
public static long getValue(byte[] bytes, int offset) {
    long value = (bytes[offset + BYTE_3] << BYTE_3_SHIFT) & BYTE_3_MASK;
    value += (bytes[offset + BYTE_2] << BYTE_2_SHIFT) & BYTE_2_MASK;
    value += (bytes[offset + BYTE_1] << BYTE_1_SHIFT) & BYTE_1_MASK;
    value += (bytes[offset] & BYTE_MASK);
    return value;
  }