you may wish to check the API documentation for the "File" class; there's a method in there that can rename files.
whether or not it can rename files to a name which already exists isn't specified in those docs, unfortunately. the quick and easy way to find out would be to try it and see what happens, i suppose. but that's assuming that this behaviour isn't platform-dependent; it shouldn't be, but i can't be entirely certain.
even if it is platform-dependent, though, there is likely an easy work-around that will work everywhere. after all, if you're trying to rename a file "A" to be named "B", but another file named "B" already exists, what do you want to happen to the "B" that already exists? there are probably methods in the "File" class that can do that for you.
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad: