public int[] getBoundaryPositions(byte[] b, byte[] boundary) {
      int matchcount = 0;
      int matchbyte = -1;
      Vector matchbytes = new Vector();
      for (int i = 0; i < b.length; i++) {
        if (b[i] == boundary[matchcount]) {
          if (matchcount == 0) matchbyte = i;
          matchcount++;
          if (matchcount == boundary.length) {
            matchbytes.addElement(new Integer(matchbyte));
            matchcount = 0;
            matchbyte = -1;
          }
        } else {
          i -= matchcount;
          matchcount = 0;
          matchbyte = -1;
        }
      }
      int[] ret = new int[matchbytes.size()];
      for (int i = 0; i < ret.length; i++) {
        ret[i] = ((Integer) matchbytes.elementAt(i)).intValue();
      }
      return ret;
    }
Find the byte positions where multipart boundaries start.
selendroid-test-app/src/main/java/io/selendroid/testapp/server/NanoHTTPD.java