According to this blog post: http://i-proving.com/2006/07/06/java-advanced-imaging/ you can use the Java Advanced Imaging Library to do what you want. The following sample code should provide you a good starting point. This will resize the image, both in height and width, as well as image quality. Once your image is of the desired file size, you can scale it back up to your desired pixel height and width when you display the image.
// read in the original image from an input stream
SeekableStream s = SeekableStream.wrapInputStream(
inputStream, true);
RenderedOp image = JAI.create("stream", s);
((OpImage)image.getRendering()).setTileCache(null);
// now resize the image
float scale = newWidth / image.getWidth();
RenderedOp resizedImage = JAI.create("SubsampleAverage",
image, scale, scale, qualityHints);
// lastly, write the newly-resized image to an
// output stream, in a specific encoding
JAI.create("encode", resizedImage, outputStream, "PNG", null);