Lately for a project of mine I had to alter the EXIF metadata of a JPEG file using Java. After googleing and improvising, I finally wrote a code sample that demonstrates how to change several metadata of a JPEG file, using the Sanselan library from Apache; you can download the jar file and source here. The code below changes Camera Model, Camera Maker and X Resolution, which are included in the Root IFD0 of a JPEG image as well as Digital Zoom Ratio and Image Width, stored in the EXIF Sub IFD.
Notice: You will be able to view the changes from the image properties of your operating system, except from the Image Width. Use this code to view the raw image metadata.