Daan Zhu,
ImageJ makes it much easier for you:
ImagePlus imp = new ij.io.Opener imageOpener.openImage("Img12Bit.tif");
imp.setProcessor(imp.getTitle(), imp.getProcessor().convertToByte(true));
new FileSaver(imp).saveAsJpeg("Img12Bit.jpg");
The paths may have to be absolute for you to control them properly.
Also: to save as jpeg, you don't need to call convertToByte at all.
ImageJ's jpeg saver will convert your image to an RGB in any case
(with scaling as well) and then save that to jpeg.
So the above need only be two lines, not three.
Albert
--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona