その前に for(int i=0; i<10000000; i++) {〜} のブロック内でindexやsearchIndexの初期化しないと、
2回目以降の while(searchIndex >= 0) {〜} のブロック素通りするんじゃない?