public static String deepToString(Iterator<?> iter) {
        StringBuilder bld = new StringBuilder("[");
        String prefix = "";
        while (iter.hasNext()) {
            Object object = iter.next();
            bld.append(prefix);
            bld.append(object.toString());
            prefix = ", ";
        }
        bld.append("]");
        return bld.toString();
    }
Copy a byte buffer into an array.  This will not affect the buffer's
position or mark.
clients/src/main/java/org/apache/kafka/common/protocol/MessageUtil.java