private int countNeighbours(int line, int row) {
		int count = 0;
		
		for(int lineOffset=-1; lineOffset <=1; lineOffset++) {
			int lineIndex = line+lineOffset;
			if(lineIndex <0 || lineIndex >= states.length) continue;
			for(int rowOffset=-1; rowOffset <=1; rowOffset++) {
				
				if(lineOffset==0 && rowOffset==0) continue;
				int rowIndex = row+rowOffset;
				if(rowIndex <0 || rowIndex >= states[lineIndex].length) continue;
				if( states[lineIndex][rowIndex]) {
					count++;
				}
			}
		}
		return count;
	}