This is not something that will be built into Java - it runs in a virtual machine, (mostly) independent of the actual Operating System. You have to rely on calling some program on the machine that will answer a question like that. This is dependant on the actual OS that is running, so it will not be cross-platform. Also you should not be asking for a password and then sending it forward.
But you should not be doing this anyway - privileges in a database should be related to the database users - not to whether the user is an admin on his computer. So you should rethink the security there.