Java? There's quite a few C/C++ based applications out there that monitor this information for Windows, and there are monitoring tools available in (at least some; haven't tried them all of course) Linux distributions...either included with the OS or again as third party programs.
Unless you are coding a Java application that can monitor these variables...I don't have a direct solution as what coding I do is minimal and does not involve Java, but
this blog post details what one coder did in Linux to develop a program along the lines you are talking about. However unless I am mistaken it looks like he called the results from an external source though, and was personally unable to develop a result wholly within Java at the time. But hopefully the example will give you some ideas, and if not you could try and contact him.
Alternatively there are a rather wide number of sites and forums on the Internet dedicated to Java development. Also you may wish to investigate or ask the denizens of the "Software/Applications/Programming" section here on Tom's as well, that is if you work with Java somewhat prodigiously.
LordHaHa