Java Glossary : radix

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : R words : radix.

radix
Radix means root in Latin. It refers to the base of the numbering system. Because we humans have ten fingers we use a base 10 numbering system (aka decimal, radix 10), After you run out of fingers counting up, you start another column.

Had we only 8 fingers we might have used base 8, (aka octal radix 8). In octal you count 0 1 2 3 4 5 6 7 10 11 12 ...

Computers internally always use base 2 (aka binary, radix 2) in which you count like this 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 ...

People intererested in the internals of computers like to use base 16 (aka hex, hexadecimal, radix 16). In it you count like this: 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 ... It is very easy to interconvert hex back and forth to binary using this little table:

Binary to Hex Conversion
binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Just break the binary number up into groups of four, (applying lead zeroes if needed) and look up the pieces in the table: e.g. 10010011110 is 0100 1001 1110 which is 49E in hex.

You can convert the computers internal binary formats (int, long) to Strings in any radix you want and back using built-in Java conversion functions.

Java has special support for octal and hex literals, and strings in number bases 2 through 36.

binary ¤ conversion ¤ Hex Editors ¤ hexadecimal ¤ HexView: allows you to view files in hex ¤ Learn To Count Applet to sharpen your intuition on how binary, hex, and octol work ¤ literals ¤ octal ¤ PGP hex encoding as words ¤ SlickEdit: allows you to view files in hex


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 2676.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/radix.html J:\mindprod\jgloss\radix.html