Java 6 API primitive type wrappers have pairs of static methods decode(String s) and valueOf(String s). Both of them return a new object of wrapper class type and none of them are annotated as deprecated. Does someone know the difference between them? For example:
Byte b1 = Byte.decode("10");
and
Byte b2 = Byte.valueOf("10");
According to the documentation (http://java.sun.com/javase/6/docs/api/java/lang/Byte.html#valueOf%28java.lang.String%29),
valueOfonly takes Strings that can be interpreted as signed decimal values, whiledecodetakes decimal, hex, or octal Strings (prefixed by 0x, #, or 0) – thoughvalueOfis overloaded to also take the radix explicitly.