In simple words, java cant do it, It can invoke another program to do it as Rob Prime said,
But if you think that java can write "0" and "1" to the disk directly and do the formatting work, you are mistaken.
Since you mention server,
what is your aim?
- is it to remotely send a command to this server that triggers a partition format ?
- is it to format itself after some timely schedule ?
both the above options can be solved by using the underlying OS: Ubuntu