How can I use or replace the code down below using for-Loop to draw size (25 * 25) rectangles in Java?
if (drawRectangles == 1) {
graphics.fillRect(430, 428, 25, 25);
}
if (drawRectangles == 2) {graphics.fillRect(430, 428, 25, 25);
graphics.fillRect(460, 428, 25, 25);
}
if (drawRectangles == 3) {
graphics.fillRect(430, 428, 25, 25);
graphics.fillRect(460, 428, 25, 25);
graphics.fillRect(490, 428, 25, 25);
}
if (drawRectangles == 4) {
graphics.fillRect(430, 428, 25, 25);
graphics.fillRect(460, 428, 25, 25);
graphics.fillRect(490, 428, 25, 25);
graphics.fillRect(520, 428, 25, 25);
}