I just cannot--for the life of me--figure out what is wrong with this code. Basically what I'm trying to do is take a value and take the index every time that value comes up in the first array. And I make a new array with the list of indexes. I don't have syntax errors, but I cannot figure out what is wrong with it, as I said before. And thanks in advance for the help.
Another problem you have is that you do not know how many results you will have, so you can't really use something fixed-length like a basic array. What if you have more results that you anticipate? You'll have an ArrayIndexOutOfBoundsException again. What if you run this method twice? After the second run you could have values left behind from the first and that if probably not good.
There are few ways to solve this. You could use a Set, a List or even a StringBuilder (use a delimiter, then do a toString and split, remembering your result will be a String array). Personally I'd use a List instance.
Why is the return just an int (in this case the j-th value in findAllArray)? Did you not say you wanted to return an array value-match indexes?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com