You can't, using only pure Java.
You can however use the Java Native Interface (JNI), and write a native extension for Java that will allow you to do this. The problem is, you'll have to write it in a native language, Java just doesn't have the option to do it.
And of course, if you use the JNI...