code: protected int marshalMessagesToSameDestination(Address dest, Message[] buf,
                                                     int start_index, final int end_index, int max_bundle_size) throws Exception {
          int num_msgs=0, bytes=0;
          for(;;) {
              Message msg=buf[start_index];
              if(msg != null && Objects.equals(dest, msg.dest())) {
                  long size=msg.size();
                  if(bytes + size > max_bundle_size)
                      break;
                  bytes+=size;
                  num_msgs++;
                  buf[start_index]=null;
                  msg.writeToNoAddrs(msg.src(), output, transport.getId());
              }
              if(start_index == end_index)
                  break;
              start_index=advance(start_index);
          }
          return num_msgs;
      }
docs: Iterate through the following messages and find messages to the same destination (dest) and write them to output