十六进制数9A48Ch可以表示为如下形式:
$$
{ \begin{array} { r l } { 9 . \mathbf { A } 4 8 \mathbf { C } \mathbf { h } = 9 \times 1 0 0 0 \mathbf { h } + } & { } \\ { \mathbf { A } \times 1 0 0 0 \mathbf { h } + } & { } \\ { 4 \times 1 0 0 \mathbf { h } + } & { } \\ { 8 \times 1 0 \mathbf { h } + } & { } \\ { \mathbf { C } \times 1 \mathbf { h } } & { } \end{array} }
$$
这个数用16的乘方表示可以写为:
$$
\begin{array} { r } { 9 \mathrm { A } 4 8 \mathrm { C h } = 9 \times 1 6 ^ { 4 } + } \\ { \mathrm { A } \times 1 6 ^ { 3 } + } \\ { 4 \times 1 6 ^ { 2 } + } \\ { 8 \times 1 6 ^ { \dagger } + } \\ { \mathrm { C } \times 1 6 ^ { 0 } } \end{array}
$$
也可以将16的幂进一步展开,写为如下形式:
$$
{ \begin{array} { r c l } { 9 { \mathrm { A } } 4 8 { \mathrm { C h } } = 9 \times 6 5 , 5 3 6 } \\ & { } \\ { \qquad \mathrm { A } \times 4 0 9 6 \ + } \\ & { } \\ { 4 \times 2 5 6 \ + } \\ & { } \\ { 8 \times 1 6 \ + } \\ & { } \\ { \qquad \subset \times 1 } \end{array} }
$$
我们可以仔细想想,如果只把一个数字(比如9,A,4,8和C中的任何一个)单独列举出来,而且不使用任何下标来指明其进制数,这种做法并不会产生二义性。无论在十进制还是十六进制下,一个单独的9仅代表9;而A的出现也说明了它本身是一个十六进制数—等价于十进制中的10。
我们可以拿起笔和纸进行演算了,把十六进制数转换成十进制数:
$$
\begin{array} { c } { 9 \mathrm { A } 4 8 \mathrm { C h } = 9 \times 6 5 , 5 3 6 \ + } \\ { 1 0 \times 4 0 9 6 \ + } \\ { 4 \times 2 5 6 \ + } \\ { 8 \times 1 6 \ + } \\ { 1 2 \times 1 } \end{array}
$$
运算的最后结果是631,948。这就是一个十六进制数转换成为十进制数的完整过程。
下面给出了一种模板,它可以帮助我们把4位十六进制转换成为十进制。
15 字节与十六进制
193