//then, we look at relative occurrences //herein lies the most disgusting code i've ever written for(int i = 0; i < toSearch.length; i++){ //find the line we need in results //j is irrelevant, just trying to find the correct results line for(int j = 0; j < results.size(); j++){ if(results.get(j).split(":")[0].equals(toSearch[i].toLowerCase())){ //we got it //look through and populate the array String curSplit[] = results.get(j).split(":"); //for each relevent document, add its array spot //k is current array spot for(int k = 1; k < curSplit.length; k++){ String curEntry = curSplit[k]; String curDoc = curEntry.split("->")[0]; if(debug){ System.out.println(curEntry.split("->")[0] + " is relevant at array spot " + k); } //find relevant document's name for(int l = 0; l < docNames.size(); l++){ if(docNames.get(l).equals(curDoc)){ Integer curNum = docs.get(docNames.get(l)); if(debug){ System.out.println("curNum = " + curNum); } curNum += k; if(debug){ System.out.println(docNames.get(l) + "'s current relevancy: " + curNum); } docs.put(docNames.get(l), curNum); break; } } } } } }