Here you can find the source of byteToObject(byte[] bytes)
public static Object byteToObject(byte[] bytes) throws Exception
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; public class Main { public static Object byteToObject(byte[] bytes) throws Exception { ObjectInputStream ois = null; try {//ww w .j a v a2 s . co m ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); return ois.readObject(); } finally { if (ois != null) ois.close(); } } }