`

Byte源码分析未完成

 
阅读更多
非常欣赏这个缓存做法。
static final Byte cache[] = new Byte[-(-128) + 127 + 1];

	static {
	    for(int i = 0; i < cache.length; i++)
		cache[i] = new Byte((byte)(i - 128));
	}
    }


 public static Byte valueOf(byte b) {
	final int offset = 128;
	return ByteCache.cache[(int)b + offset];
    }

菜鸟见识少,惊喜多!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics