参考博客:
http://www.cnblogs.com/yuanchenqi/articles/6835654.html
http://www.cnblogs.com/yuanchenqi/articles/6000358.html