code: public static BufferedImage ByteBufferImage( byte[] data, int width, int height ) {
          int[] bandoffsets = {0, 1, 2, 3};
          DataBufferByte dbb = new DataBufferByte(data, data.length);
          WritableRaster wr = Raster.createInterleavedRaster(dbb, width, height, width * 4, 4, bandoffsets, null);
          int[] bitfield = {8, 8, 8, 8};
  
          ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
          ColorModel cm = new ComponentColorModel(cs, bitfield, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
  
          return new BufferedImage(cm, wr, false, null);
      }
docs: create a buffered image from a set of color triplets
  
  @param data
  @param width
  @param height
  @return