前几天面试遇到这个问题:在Java中如何将字符串转化为整数,当时too young too naive,随便回答了一下.今天跑去看Java源码中paresInt函数的写法,Oh my god!其实不看也能写出来,但是我觉得源码中的实现更好.下面贴出源码顺道分析一下: /* @param s the {@code String} containing the integer * representation to be parsed * @param radix the radix to be u