code: public static final long move(ByteBuffer[] bbArray1, int offset1, int length1, ByteBuffer[] bbArray2, int offset2, int length2)
      {
          if (length1 == 0 || length2 == 0)
          {
              return 0;
          }
          long res = 0;
          ArrayIterator<ByteBuffer> i1 = new ArrayIterator<>(bbArray1, offset1, length1);
          ArrayIterator<ByteBuffer> i2 = new ArrayIterator<>(bbArray2, offset2, length2);
          ByteBuffer b1 = i1.next();
          ByteBuffer b2 = i2.next();
          while (true)
          {
              res += move(b1, b2);
              if (!b1.hasRemaining())
              {
                  if (i1.hasNext())
                  {
                      b1 = i1.next();
                  }
                  else
                  {
                      return res;
                  }
              }
              if (!b2.hasRemaining())
              {
                  if (i2.hasNext())
                  {
                      b2 = i2.next();
                  }
                  else
                  {
                      return res;
                  }
              }
          }
      }
docs: Moves bytes from ba1 to ba2 as much as is possible. Positions are moved
  according to move. Returns number of bytes moved.
  @param bbArray1
  @param offset1
  @param length1
  @param bbArray2
  @param offset2
  @param length2
  @return
  @see java.nio.channels.GatheringByteChannel
  @see java.nio.channels.ScatteringByteChannel