public static Object bytesToObject(byte[] bytes) throws IOException, ClassNotFoundException {
  ByteArrayInputStream inStream=new ByteArrayInputStream(bytes);
  ObjectInputStream in=new ContextClassLoaderObjectInputStream(inStream);
  Object data=in.readObject();
  in.close();
  return data;
}

public static Object bytesToObject ( byte [ ] bytes ) throws IOException , ClassNotFoundException { ByteArrayInputStream inStream = new ByteArrayInputStream ( bytes ) ; ObjectInputStream in = new ContextClassLoaderObjectInputStream ( inStream ) ; Object data = in . readObject ( ) ; in . close ( ) ; return data ; }
convert a byte array into an object .
