Define "connected" in terms that make sense looking at the graphic you posted. If there's a connected path in the graphic, describe it or draw it.
Show the class you created that represents each "1". Rather than boolean fields to indicate if there's a connection to an adjacent neighbor, you may want to use a pointer to the adjacent neighbor if a connection exists, null if a connection does not exist. Using that approach, a path through the field of "1"s might be similar to data structures you're already familiar with or a tree of some kind.