revise java code
private static BufferedImage removeAlphaChannel(BufferedImage img) {
if (!img.getColorModel().hasAlpha()) {
return img;
}




    BufferedImage target = createImage(img.getWidth(), img.getHeight(), false);
    Graphics2D g = target.createGraphics();
    // g.setColor(new Color(color, false));
    g.fillRect(0, 0, img.getWidth(), img.getHeight());
    g.drawImage(img, 0, 0, null);
    g.dispose();

    return target;
}