Easiest way of deep cloning (with some performance overhead) is Serialization. It involves serializing the object to bytes and from bytes to object again.
We should prefer to use in memory deep cloning whenever it is the only need and we don’t need to persist the object for future use.
For deep cloning, we have to first serialization and then deserialization. For serialization, I have used ByteArrayOutputStream and ObjectOutputStream. For deserialization, I have used ByteArrayInputStream and ObjectInputStream.