I would put this as a comment, but my reputation point is not enough. One way is using the commands the operating system provides. You can run a command with
Runtime.getRuntime().exec("<command name>");
This will give you the related process and you can get the output of that process just as manually running the process. Then, you can utilize the output. Basically if the OS provides you that information manually, you should be able to get the information within Java.