public static void valueVectorProduct(byte value, ByteBuffer vector, ByteBuffer result, int length) {
if (value == 1) { // if multiplied by one, simply copy the source vector data and return
if (vector != result) { // avoid unnecessary copy if in-place product
BufferOperation op = BufferOperation.RESTORE_POSITION;
ByteBuffers.copy(vector, op, result, op, length);
}
}
else if (value == 0) { // if multiplied by zero, simply fill the result with zeros and return
ByteBuffers.putZeros(result, length, BufferOperation.RESTORE_POSITION);