code: public static Serializable copy(Serializable obj) {
          try {
              ByteArrayOutputStream buf = new ByteArrayOutputStream(4096);
              ObjectOutputStream out = new ObjectOutputStream(buf);
              out.writeObject(obj);
              out.close();
  
              ByteArrayInputStream buf2 = new ByteArrayInputStream(buf.toByteArray());
              ObjectInputStream in = new ObjectInputStream(buf2);
              Serializable            obj2 = (Serializable) in.readObject();
              in.close();
  
              return obj2;
          } catch (IOException e) {
              throw new RuntimeException(e);
          } catch (ClassNotFoundException e) {
              throw new RuntimeException(e);
          }
      }
docs: Makes a deep-copy clone of an object.
  @param obj   target object, that must implements {@link java.io.Serializable}
  @return deep-copy