// bitsPerDigit in the given radix times 1024
// Rounded up to avoid underallocation.
private static long bitsPerDigit[] = { 0, 0,
1024, 1624, 2048, 2378, 2648, 2875, 3072, 3247, 3402, 3543, 3672,
3790, 3899, 4001, 4096, 4186, 4271, 4350, 4426, 4498, 4567, 4633,
4696, 4756, 4814, 4870, 4923, 4975, 5025, 5074, 5120, 5166, 5210,
5253, 5295}; //如何得来的? // Pre-allocate array of expected size. May be too large but can
// never be too small. Typically exact.
int numBits = (int)(((numDigits * bitsPerDigit[radix]) >>> 10) + 1); //是什么意思?
int numWords = (numBits + 31) /32;
mag = new int[numWords];其中 numDigits 为数字个数,如 "334455", numDigits是6
// Rounded up to avoid underallocation.
private static long bitsPerDigit[] = { 0, 0,
1024, 1624, 2048, 2378, 2648, 2875, 3072, 3247, 3402, 3543, 3672,
3790, 3899, 4001, 4096, 4186, 4271, 4350, 4426, 4498, 4567, 4633,
4696, 4756, 4814, 4870, 4923, 4975, 5025, 5074, 5120, 5166, 5210,
5253, 5295}; //如何得来的? // Pre-allocate array of expected size. May be too large but can
// never be too small. Typically exact.
int numBits = (int)(((numDigits * bitsPerDigit[radix]) >>> 10) + 1); //是什么意思?
int numWords = (numBits + 31) /32;
mag = new int[numWords];其中 numDigits 为数字个数,如 "334455", numDigits是6
bitsPerDigit[10]为什么是3402
位移10位是什么意思?
http://blog.csdn.net/sxpujs/archive/2009/03/19/4005654.aspx
为什么要位移10位?这些语句要表达的除了字面运算上,内在的意思?
JAVA移位运算符http://blog.csdn.net/sxpujs/archive/2009/03/19/4005654.aspx
头昏
这个为什么要这么实现是吧?
我劝LZ暂时不要深究
等你把JDK弄明白了 就会想到为什么要这么实现了
然后你会觉得还有很多其他的实现方式
SUN选择这么做并不是一定要这么做
他要做的只是要选择一种实现的方式把他实现出来
所有就这么做了
程序想把一个radix进制的数转换成十进制方便计算
代码为神级,鉴定完毕