private void init(int size, boolean createSquares) { this.size = size; this.sizeSqrt = (int) Math.sqrt(size); this.squares = new Square[size][size]; this.rows = new Group[size]; this.cols = new Group[size]; if (this.sizeSqrt > 1) { this.groups = new Grid[size]; } if (createSquares) { createSquares(); } }