Here you can find the source of deepClone(Object src)
public static Object deepClone(Object src) throws IOException, ClassNotFoundException
//package com.java2s; //License from project: LGPL import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class Main { public static Object deepClone(Object src) throws IOException, ClassNotFoundException { ByteArrayOutputStream betyArrayOutputStream = new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(betyArrayOutputStream); objectOutputStream.writeObject(src); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(betyArrayOutputStream.toByteArray()); ObjectInputStream objInputStream = new ObjectInputStream(byteArrayInputStream); return objInputStream.readObject(); }/*from w w w. jav a2s. com*/ }