This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Usually, we use 2 kinds of static valueOf() methods when it comes to wrapper classes: valueOf(String arg) valueOf(String arg, int arg_base) where arg is the String representation of the primitive and arg_base is the int representation of the radix/base of the arg. Now, coming to my example code written above, the arg is 01010 which is a binary value, so the base/radix should be 2 right? But, I've used 8 for octal and it still compiles?!! WHY?
As Keith wrote, the digits 0 and 1 are valid in the octal radix. Remember that 01010 to the compiler is an octal literal because of the leading 0, but you are using a String "01010" of digits in radix 8 which is going to be parsed at runtime, not at compile time.