// From http://code.calum.org/ public static Object byteArrayToObject(byte[] b){ // System.out.println("byteArrayToObject: byte size is " + b.length + " bytes"); ByteArrayInputStream bais = new ByteArrayInputStream(b); try { ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); return o; } catch (ClassNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } return null; }