// Find smallest year
int pastMin=0;
int currentMin=ontarioBankInfoInt.get(0);
int currentMinIndex=0;
int reps=(ontarioBankInfoInt.size()-1)/3;
for(int x=0; x<=reps; x++){
for (int i=0; i<ontarioBankInfoInt.size()-1; i++){
if (ontarioBankInfoInt.get(i)<currentMin){
if (ontarioBankInfoInt.get(i)>pastMin){
currentMin = ontarioBankInfoInt.get(i);
currentMinIndex = i;
pastMin = currentMin;
}//If End
}//If End
}//For End
//Add other information
yearArray.add(currentMin);
}//For End
注: reps は、検索に必要な年数です。このコードの目的は、arrayList で最小の年を検索し、それを「yearArray」に追加してから、次の最小の追加を見つけてそれを言う配列に追加し、すすぎ、配列全体で機能するまで繰り返すことです。
私の問題は、常に同じ年に返されることです。なぜ助けになるのかわからないのですか?
ありがとう