private BufferedImage rotate(BufferedImage img,int angle){
  int w=img.getWidth();
  int h=img.getHeight();
  BufferedImage dimg=new BufferedImage(w,h,img.getType());
  Graphics2D g=dimg.createGraphics();
  g.rotate(Math.toRadians(angle),w / 2.d,h / 2.d);
  g.drawImage(img,null,0,0);
  return dimg;
}

private BufferedImage rotate ( BufferedImage img , int angle ) { int w = img . getWidth ( ) ; int h = img . getHeight ( ) ; BufferedImage dimg = new BufferedImage ( w , h , img . getType ( ) ) ; Graphics2D g = dimg . createGraphics ( ) ; g . rotate ( Math . toRadians ( angle ) , w / 2.d , h / 2.d ) ; g . drawImage ( img , null , 0 , 0 ) ; return dimg ; }
rotates the given image with the specified angle .
