private static void multiplyArrays4And4To4NoOverflow(int[] left, int[] right) {
    assert (left.length == 4);
    assert (right.length == 4);
    long product;

    product = (right[0] & SqlMathUtil.LONG_MASK)
        * (left[0] & SqlMathUtil.LONG_MASK);
    int z0 = (int) product;

    product = (right[0] & SqlMathUtil.LONG_MASK)
        * (left[1] & SqlMathUtil.LONG_MASK)
        + (right[1] & SqlMathUtil.LONG_MASK)
        * (left[0] & SqlMathUtil.LONG_MASK) + (product >>> 32);
    int z1 = (int) product;

    product = (right[0] & SqlMathUtil.LONG_MASK)
        * (left[2] & SqlMathUtil.LONG_MASK)
        + (right[1] & SqlMathUtil.LONG_MASK)
        * (left[1] & SqlMathUtil.LONG_MASK)
        + (right[2] & SqlMathUtil.LONG_MASK)
        * (left[0] & SqlMathUtil.LONG_MASK) + (product >>> 32);
    int z2 = (int) product;

    // v[3]
    product = (right[0] & SqlMathUtil.LONG_MASK)
        * (left[3] & SqlMathUtil.LONG_MASK)
        + (right[1] & SqlMathUtil.LONG_MASK)
        * (left[2] & SqlMathUtil.LONG_MASK)
        + (right[2] & SqlMathUtil.LONG_MASK)
        * (left[1] & SqlMathUtil.LONG_MASK)
        + (right[3] & SqlMathUtil.LONG_MASK)
        * (left[0] & SqlMathUtil.LONG_MASK) + (product >>> 32);
    int z3 = (int) product;
    if ((product >>> 32) != 0) {
      SqlMathUtil.throwOverflowException();
    }

    // the combinations below definitely result in overflow
    if ((right[3] != 0 && (left[3] != 0 || left[2] != 0 || left[1] != 0))
        || (right[2] != 0 && (left[3] != 0 || left[2] != 0))
        || (right[1] != 0 && left[3] != 0)) {
      SqlMathUtil.throwOverflowException();
    }

    left[0] = z0;
    left[1] = z1;
    left[2] = z2;
    left[3] = z3;
  }
Multiplies this value with the given value.

@param left
         the value to multiply. in AND out.
@param right
         the value to multiply. in
common/src/java/org/apache/hadoop/hive/common/type/UnsignedInt128.java