How do I convert hexadecimal to binary to decimal and vice versa?

A simple post providing various methods of converting hexadecimal, binary and decimal with different Solaris commands.

hexadecimal to decimal

CommandExampleResults
adb
(Solaris 2.6 / 7)
echo "0xff=d" | /usr/bin/adb converts ff into 255
echo "0t255=x" | /usr/bin/adb converts 255 to ff
mdb
(Solaris 8 / 9 / 10)
echo "0xff=d" | /usr/bin/mdb converts ff into 255
echo "0t255=x" | /usr/bin/mdb converts 255 to ff
bc echo "ibase=16; ff" | /usr/bin/bc converts ff into 255
echo "obase=16; 255" | /usr/bin/bc converts 255 to FF
dc echo "10 16 o i FF p" | dc converts FF to 255
echo "16 10 o i 255 p" | dc converts 255 to FF
printf /usr/bin/printf '%d\n' 0xff converts ff to 255
/usr/bin/printf '%x\n' 255 converts 255 to ff

binary to decimal

CommandExampleResults
bc echo "ibase=2; 11111111" | /usr/bin/bc converts 11111111 into 255
echo "obase=2; 255" | /usr/bin/bc converts 255 to 11111111
dc echo "2 10 o i 11111111 p" | dc converts 11111111 to 255
echo "10 2 o i 255 p" | dc converts 255 to 11111111

hexadecimal to binary

CommandExampleResults
bc echo 'obase=2;ibase=16;7F8' | /usr/bin/bc converts 7f8 to 11111111000
echo "obase=16;ibase=2;1101111000" | /usr/bin/bc converts 1101111000 to 378