Comparing timestamps is not completely reliable in detecting changes to a file. You can compare checksums of the file, using a md5 or crc32 checksum to determine if the file has changed.
You could do something like this:
1. The client calculates the checksum of it's files.
2. The client sends the checksum to the server.
3. The server calculates the checksum of it's file and compares it against the checksum that the client sent over (the client's checksum).
4. If the checksums do not match, then the server must have a newer file, send the file to the client.
As for the java code to calculate the checksum, you can probably find something using a search engine since I haven't done this before in java.
java.util.zip.CRC32 in the JDK and
http://www.ietf.org/rfc/rfc1321.txt might get you started.
Eddy