public static Set<Byte> from32BitField(final int intValue) {
        Set<Byte> result = new HashSet<>();
        for (int itr = intValue, count = 0; itr != 0; itr >>>= 1) {
            if ((itr & 1) != 0)
                result.add((byte) count);
            count++;
        }
        return result;
    }
Write the contents of a buffer to an output stream. The bytes are copied from the current position
in the buffer.
@param out The output to write to
@param buffer The buffer to write from
@param length The number of bytes to write
@throws IOException For any errors writing to the output
clients/src/main/java/org/apache/kafka/common/utils/Utils.java