Here you can find the source of loadImage(byte[] data)
public static BufferedImage loadImage(byte[] data) throws IOException
//package com.java2s; //License from project: Apache License import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; public class Main { public static BufferedImage loadImage(byte[] data) throws IOException { BufferedImage img = null; try (InputStream input = new ByteArrayInputStream(data)) { img = ImageIO.read(input); }//from w w w .j ava 2 s . c o m return img; } }