Game of life moderate challenge solved in java