Valid Number, used a finite automata machine

I had referred http://blog.csdn.net/kenden23/article/details/18696083
to solve.