public static void main(String[] args)throws Exception {
ArrayList proxy=(ArrayList)Proxy.newProxyInstance(
ArrayList.class.getClassLoader(),
new Class[]{Serializable.class,Cloneable.class,Iterable.class,Collection.class,List.class,RandomAccess.class},
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
ArrayList target=new ArrayList();
long beginTime=System.currentTimeMillis();
Object retVal=method.invoke(target, args);
Thread.sleep(1000);
long endTime=System.currentTimeMillis();
System.out.println(method.getName()+"Running "+(endTime-beginTime));