きったんの頭

// <applet code="TSquare.class" width="512" height="512"></applet>
/**
 * TSquare.java
 * @see https://mind.kittttttan.info/java/t_square
 */
import java.applet.*;
import java.awt.*;

public class TSquare extends Applet {
    private static final int TIMES = 9;
    private static final int SIZE = 1 << TIMES;

    public void paint(Graphics g) {
        int unit, u2, u4;
        for (int n = 0; n < TIMES; n++) {
            unit = SIZE >>> n;
            u2 = unit >>> 1;
            u4 = unit >>> 2;
            for (int i = 0; i < SIZE; i++) {
                for (int j = 0; j < SIZE; j++) {
                    g.fillRect(unit*i + u4, unit*j + u4, u2, u2);
                }
            }
        }
    }
}