code: public static <T extends Serializable> T deserializeFromBytes(byte[] serialized, Class<T> clazz)
        throws IOException {
  
      try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(serialized))) {
        return clazz.cast(ois.readObject());
      } catch (ClassNotFoundException e) {
        throw new IOException(e);
      }
    }
docs: Deserialize a String obtained via {@link #serializeIntoBytes(Serializable)} into an object.
  
  @param serialized The serialized bytes
  @param clazz The class the deserialized object should be cast to.
  @return The deserialized object
  @throws IOException if it fails to deserialize the object