// get the index number of a food pile that the given ant is on. public int getFoodPileIndex(Ant currentAnt) { for (int i = 0; i < Parameters.NUM_OF_FOOD_PILES; i++) { if (theFood[i].getX() == currentAnt.getX() && theFood[i].getY() == currentAnt.getY()) return i; } System.out.println("Reached the unreachable"); return -1; // this line will never happen but eclipse made me add another return state }