I don't know what you mean when you say "How to detect that drive?" It isn't your program's job to detect the drive. The operating system will do that and assign a drive letter (if it's Windows) or some other identification (if it's some other O/S). Perhaps you meant to ask how to find out which drive letter Windows assigned, or something like that?
As for how to copy a file, here's some example code which I found in about half a minute using the Google keywords
java copy files example:
Copy a file.