Consider the code for rotating an image to the left. If we wish to change it so that it rotates an image clockwise by +180 degrees or counterclockwise by -180 degrees (which is the same), then the new BufferedImage should be:
BufferedImage(w, h, BufferedImage.TYPE_INT_RGB)
The rotate() line should be changed to:
graphics.rotate(PI)
or to:
graphics.rotate(-PI)
What is the correct change for the translate() line? Remember that rotation is performed around the top-left corner.