import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;

ImageIO.write( aBufferedImage, "GIF" /* format desired */ , new File( "snap.gif" ) /* target */ );