code: public void setRGB(final BufferedImage IMAGE, final int X, final int Y, final int WIDTH, final int HEIGHT, final int[] PIXELS) {
          int type = IMAGE.getType();
          if (type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB) {
              IMAGE.getRaster().setDataElements(X, Y, WIDTH, HEIGHT, PIXELS);
          } else {
              IMAGE.setRGB(X, Y, WIDTH, HEIGHT, PIXELS, 0, WIDTH);
          }
      }
docs: A convenience method for setting ARGB pixels in an image. This tries to avoid the performance
  penalty of BufferedImage.setRGB unmanaging the image.
  @param IMAGE
  @param X
  @param Y
  @param WIDTH
  @param HEIGHT
  @param PIXELS