It is very system specific, there is no universal way to perform this. Your options are
- Create a JNI library to perform this using system calls
- Write a wrapper class around utilities that perform this operation (for example, capture stdout and give inputs to stdin for an external process)
- Use OS-specific techniques (as previously mentioned) to zero out devices
- Use something like fat32-lib to manipulate specific file system types.