How do I get my screen size?

package org.kodejava.example.awt;

import java.awt.*;

public class ScreenSizeExample {
    public static void main(String[] args) {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

        System.out.println("Screen Width: " + screenSize.getWidth());
        System.out.println("Screen Height: " + screenSize.getHeight());
    }
}