am making a small program where the user browses an image then the image get's copied into some directory then i want it to be resized if the size is bigger than the required max size. ok how?

You can resize image using width and height you can also use for loops to achive that

horizontal resize

for (int x = 0; x < screenWidth; x++) 
{
          g.setClip(x, 0, 1, srcHeight);
          g.drawImage(src, x - (pos >> 16), 0, Graphics.LEFT | Graphics.TOP);
          pos += ratio;
}

Vertical resize

for (int y = 0; y < screenHeight; y++) 
{
          g.setClip(0, y, screenWidth, 1);
          g.drawImage(tmp, 0, y - (pos >> 16), Graphics.LEFT | Graphics.TOP);
          pos += ratio;
}