Search Array of Strings in Array of String, receive Int-Array of indexes I'm looking for an lib which can search an array of strings with multible search-strings (array). I want to get an int-array of all indexes/matches.

private int[] getIndexArray(String[] pArray, String[] pSearchStrings) {
    int[] indexes = new int[0];
    for (String str : pArray) {
        if (ArrayUtils.contains(pSearchStrings, str))
            indexes = ArrayUtils.add(indexes, ArrayUtils.indexOf(pArray, str));
    }
    return indexes;
}


Is there a better way of doing it?
If you use pSearchStrings[] for all pArray[], you can transform pSearchStrings in a Pattern and use matcher method to avoid to load each time ArrayUtils.contains(..)

EDIT

private static int[] getIndexArray(String[] pArray, String[] pSearchStrings) {
    StringBuilder sb = new StringBuilder((int) estimateSizeOfSearchStrings +16);
    for (String searh : pSearchStrings) {
         sb.append(".*");
         sb.append(search)
         sb.append(".*|");
    }
    Pattern patt = Pattern.compile(sb.toString().subString(0,sb.length() -1);
    // If pSearchStrings are always the same, you can put static 'patt' outside this method
    // Or pass pre-compiled 'patt' as a parameter.
    int [] indexes = new int [pSearchStrings.length];
    int i = 0;
    for (String str : pArray) {
            if (patt.matcher(str).find())
            indexes[i++] = ArrayUtils.indexOf(pArray, str);
    }
    return indexes;
}