For bases larger than 10, the letters a,b,c,... or A,B,C,... can be used to denote the numbers 11, 12 and so forth. Use of leading zeros or leading 0x is not supported nor necessary. If a mere base conversion with "input=output" is selected, the unix calculator dc(1) is an obvious quicker alternative, which in addition allows to change the basis of the output format.
See the MathWorld description, and sequences A006068, A003188 and others in the OEIS. This gray.java here implements the equivalent of K D Quitt's C++ code C++ code within the BigInteger class.
Richard J Mathar, www.mpia.de/~mathar