code: public static NDArrayMessage[] chunkedMessages(NDArrayMessage arrayMessage, int chunkSize) {
          int sizeOfMessage = NDArrayMessage.byteBufferSizeForMessage(arrayMessage) - 4;
          int numMessages = sizeOfMessage / chunkSize;
          ByteBuffer direct = NDArrayMessage.toBuffer(arrayMessage).byteBuffer();
          NDArrayMessage[] ret = new NDArrayMessage[numMessages];
          for (int i = 0; i < numMessages; i++) {
              byte[] chunk = new byte[chunkSize];
              direct.get(chunk, i * chunkSize, chunkSize);
              ret[i] = NDArrayMessage.builder().chunk(chunk).numChunks(numMessages).build();
          }
          return ret;
      }
docs: Create an array of messages to send
  based on a specified chunk size
  @param arrayMessage
  @param chunkSize
  @return