Here you can find the source of ByteToObject(byte[] bytes)
public static Object ByteToObject(byte[] bytes)
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; public class Main { public static Object ByteToObject(byte[] bytes) { Object obj = null;/*from w ww .ja v a 2 s . c o m*/ try { // bytearray to object ByteArrayInputStream bi = new ByteArrayInputStream(bytes); ObjectInputStream oi = new ObjectInputStream(bi); obj = oi.readObject(); bi.close(); oi.close(); } catch (Exception e) { e.printStackTrace(); } return obj; } }