Valid Number in Java

not very difficult but really complicated :-0