You seem to have some very odd counting going on there. First off you aren't incrementing the loop. You do set the index1 to the value of index2 which I assume is an attempt to increment the loop towards savedLines.length(), but nothing is guarantying that it is systematically incrementing its way toward that value without jumping right past it in the first run through the loop. Plus you are using your counting variable in the loop. So index1 gets what ever value is in index2 while index2 got some value from value derived from an indexOf() method call using index1 as a base.

Code:
index2=savedLines.indexOf("\"", (index1+1));  //seems odd to use the count this way
what is savedLines anyway? A String? A Collection?

I think you are trying to get your loop to do too much. I would be for using the enhanced for loop to iterate over your data structure or, if it is a collection then use an iterator.

Good luck.