Look at the static conversion methods in Integer, Long and other wrapper classes.
parseInt(
String s, int radix ) will do base 8 and 16 from String to int.
toHexString( int n )
toOctalString( int n )
toBinaryString( int n )
are handy too. You might see constants in hex format but I don't think they ever use octal in a question.
Bill