You don't have to resort to trial and error if you understand what you are doing.

public class LEDDisplay {
boolean[][] matrix;

public LEDDisplay() {
boolean[][] matrix = new...