code: private static boolean isPrefix(byte[] needle, int p) {
          int l = needle.length;
          for (int i = p, j = 0; i < l; ++i, ++j) {
              if (needle[i] != needle[j]) {
                  return false;
              }
          }
          return true;
      }
docs: Is needle[p:end] a prefix of needle?