I agree with Rusty. Java is the wrong tool for this job. Partly because such low-level work varies so much between different hardware. Java is a high-level language that is meant to be platform-indepenedent. Even if you could find a way to make Java work at such a low-level, it would lose that. Instead,
you should use Assembly or C which are both much better tools for this type of work.