I want to calculate percentage of CPU usage of OS from java code.
unix
mpstat
You can use the SIGAR API. It is cross platform ( but I've only use it on Windows).
The Javadoc is available here and the binaries are here
It is licensed under the terms of the Apache 2.0 license.