public static byte[] toNullableArray(ByteBuffer buffer) {
        return buffer == null ? null : toArray(buffer);
    }
Convert a ByteBuffer to a nullable array.
@param buffer The buffer to convert
@return The resulting array or null if the buffer is null
clients/src/main/java/org/apache/kafka/common/utils/Utils.java