private void findPlanetOnStar(Star star) { int highestPopulationCongeniality = 0; for (BasePlanet planet : star.getPlanets()) { if (planet.getPopulationCongeniality() > highestPopulationCongeniality) { highestPopulationCongeniality = planet.getPopulationCongeniality(); mPlanetIndex = planet.getIndex(); } } }