Camilo Sánchez Herrera wrote:
this is the N property of my class, and the method isMagicSquare returns false if there is a single row or column wich sum is different from N
Sorry, I didn't notice that. I cannot understand how you generate the squares to check, but, if you're not already doing it, maybe you could check every generated row and only generate a next one if the sum of the previous one equals N. BTW, is it a school/university assignment?