private Info checkIfNeighbor(int r, int c) { Info info = new Info(0, false, false); if (r >= 0 && r < lastGeneration.length && c >= 0 && c < lastGeneration[0].length) { if (lastGeneration[r][c].getStatus() > 0) { if (lastGeneration[r][c].isCured()) { info.cured = true; } else if (lastGeneration[r][c].isDiseased()) { info.diseased = true; } info.neighbors++; } } return info; }