import java.awt.image.BufferedImage;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Test3 {
public static void main(String[] args) throws IOException {
int i =0;
int w = 320;
int h = 240;
int imageData[] = new int[w * h];
FileInputStream file_input = new FileInputStream ("D:abc.bin");
DataInputStream data_in = new DataInputStream (file_input );
while (true) {
try {
imageData[i++] = data_in.readInt ();
}
catch (EOFException eof) {
System.out.println ("End of File");
break;
}
}
BufferedImage finalImage;
finalImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);//TYPE_INT_ARGB
finalImage.setRGB(0, 0, w, h, imageData, 0 ,w);
ImageIO.write(finalImage, "bmp", new File("D:abc.bmp"));
}
}