private int calculateExtraLength(final Object... extraHeaders) {
    int extraLen = 0;
    for (Object o : extraHeaders) {
      if (o instanceof Integer) {
        extraLen += 4;
      } else if (o instanceof byte[]) {
        extraLen += ((byte[]) o).length;
      } else if (o instanceof Long) {
        extraLen += 8;
      } else  if (o instanceof Short) {
        extraLen += 2;
      } else {
        assert false : "Unhandled extra header type:  " + o.getClass();
      }
    }
    return extraLen;
  }
Calculate the length of all extra headers.

@param extraHeaders the list of extra headers to count.
@return the length of the extra headers.
src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java