code: public static void rotateImage(File input, File output, String format, int degrees) 
  	  throws IOException
  	  {
  	   	   
  		  BufferedImage inputImage = ImageIO.read(input);	   
  
  		    Graphics2D g = (Graphics2D) inputImage.getGraphics();
  		    g.drawImage(inputImage, 0, 0, null);
  	
  		    AffineTransform at = new AffineTransform();
  	
  		    // scale image
  		    //at.scale(2.0, 2.0);
  	
  		    // rotate 45 degrees around image center
  		    at.rotate(degrees * Math.PI / 180.0, inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0);
  		    //at.rotate(Math.toRadians(degrees), inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0);
  	
  		   
  		    /*
  		     * translate to make sure the rotation doesn't cut off any image data
  		     */
  		    AffineTransform translationTransform;
  		    translationTransform = findTranslation(at, inputImage);
  		    at.preConcatenate(translationTransform);
  		   
  		    
  		    // instantiate and apply transformation filter
  		    BufferedImageOp bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
  		    
  		    BufferedImage destinationBI = bio.filter(inputImage, null);
  	
  		    ImageIO.write(destinationBI, format, output);
  		    
  	  }
docs: Rotate a file a given number of degrees
  @param input input image file
  @param output the output image fiel
  @param format the format (png, jpg, gif, etc.)
  @param degrees angle to rotote
  @throws IOException