Updating ImagePlus object with 1D array

What is the best way of updating ImagePlus object with intensity counts I have obtained directly from cameras?

Here a small plugin example which produces a float image and updates the image with random values 10 times. The resetMinAndMax function in this example needs only to be called after the first random values but it might be useful if you have various ranges. Instead of random values fill you 1D array in the update function!

import ij.ImagePlus;
import ij.plugin.PlugIn;
import ij.process.FloatProcessor;

public class My_Plugin implements PlugIn {

	public void run(String arg) {
		FloatProcessor ip = new FloatProcessor(500, 500);
		ImagePlus imp = new ImagePlus("Example", ip);
		imp.show();

		int width = imp.getWidth();
		int height = imp.getHeight();

		for (int i = 0; i < 10; i++) {
			update(ip, width, height);
			try {
				Thread.sleep(500);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

			imp.updateAndDraw();
		}

	}

	private void update(FloatProcessor ip, int width, int height) {

		for (int y = 0; y < height; y++) {
			for (int x = 0; x < width; x++)
				ip.putPixelValue(x, y, Math.random() * 10000);

		}
		ip.resetMinAndMax();
	}
}

From the ImageJ API:

updateAndDraw()
Updates this image from the pixel data in its associated ImageProcessor, then displays it. Does nothing if there is no window associated with this image (i.e. show() has not been called).

resetMinAndMax()
Recalculates the min and max values used to scale pixel values to 0-255 for display. This ensures that this FloatProcessor is set up to correctly display the image.