how to get the screen dimensions in java

Java
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Source

Also in Java: