<p>Is there a way to shutdown a computer using a built-in Java method?</p>

Create your own function to execute an OS command through the
command line
?
For the sake of an example. But know where and why you'd want to use this as others note.
```
```
public static void main(String arg[]) throws IOException{
    Runtime runtime = Runtime.getRuntime();
    Process proc = runtime.exec("shutdown -s -t 0");
    System.exit(0);
}
```
```