code: public void writeUnscaledValue(Slice slice)
      {
          BigInteger value = Decimals.decodeUnscaledValue(slice);
  
          // encode the signed number as a positive integer
          value = value.shiftLeft(1);
          int sign = value.signum();
          if (sign < 0) {
              value = value.negate();
              value = value.subtract(BigInteger.ONE);
          }
          int length = value.bitLength();
          while (true) {
              long lowBits = value.longValue() & 0x7fff_ffff_ffff_ffffL;
              length -= 63;
              // write out the next 63 bits worth of data
              for (int i = 0; i < 9; ++i) {
                  // if this is the last byte, leave the high bit off
                  if (length <= 0 && (lowBits & ~0x7f) == 0) {
                      buffer.write((byte) lowBits);
                      return;
                  }
                  else {
                      buffer.write((byte) (0x80 | (lowBits & 0x7f)));
                      lowBits >>>= 7;
                  }
              }
              value = value.shiftRight(63);
          }
      }
docs: This comes from the Apache Hive ORC code