当前位置:网站首页>学习记录并且简单分析
学习记录并且简单分析
2020-11-08 15:22:00 【程序猿欧文】
学习记录并且简单分析
记录学习遇到的困难,一个小白!
本人基本没有读过源码,纯小白一个,写这篇文章纯属是为了提高自己!!!希望各位积极指出错误。
好奇的我翻看了Integer.valueOf()方法源码
public static Integer valueOf(int i) { if (i >= IntegerCache.low && i <= IntegerCache.high) return IntegerCache.cache[i + (-IntegerCache.low)]; return new Integer(i); }
首先参数解释:
static final int low = -128;static final int high;static final Integer[] cache;static Integer[] archivedCache;
high没有赋值,所以我们继续跟踪到high属性
static { int h = 127; //启动时如果指定-Djava.lang.Integer.IntegerCache.high=XXX(自己输入一个数据)参数 //将会执行下面的语句,则动态的设置h是127还是设置的输入数据 String integerCacheHighPropValue = //该方法是通过传递一个key,获取启动时手动设定的数值 VM.getSavedProperty("java.lang.Integer.IntegerCache.high"); if (integerCacheHighPropValue != null) { try { h = Math.max(parseInt(integerCacheHighPropValue), 127); // // public static int max(int a, int b) { // return (a >= b) ? a : b; // } // Maximum array size is Integer.MAX_VALUE //32位系统2147483647=2^32 h = Math.min(h, Integer.MAX_VALUE - (-low) -1); } catch( NumberFormatException nfe) { // If the property cannot be parsed into an int, ignore it. } } //找到high属性的值由h局部属性赋值 high = h; // Load IntegerCache.archivedCache from archive, if possible VM.initializeFromArchive(IntegerCache.class); int size = (high - low) + 1;//可以存256个数。 //至于为啥是256?这里我不讲述,建议自己去搜索下计算机存放数据相关的概念! // Use the archived cache if it exists and is large enough.........
版权声明
本文为[程序猿欧文]所创,转载请带上原文链接,感谢
https://my.oschina.net/mikeowen/blog/4708221
边栏推荐
- PMP experience sharing
- Windows下快递投递柜、寄存柜的软件初探
- 用 Python 写出来的进度条,竟如此美妙~
- Golang 系统ping程序探测存活主机(任意权限)
- 10个常见的软件架构模式
- Q & A and book giving activities of harbor project experts
- Drink soda, a bottle of soda water 1 yuan, two empty bottles can change a bottle of soda, give 20 yuan, how much soda can you
- 三、函数的参数
- 小米、OPPO在欧洲市场继续飙涨,小米更是直逼苹果
- Leancloud changes in October
猜你喜欢

分布式文档存储数据库之MongoDB基础入门

python基础教程python opencv pytesseract 验证码识别的实现

模板引擎的整理归纳

Powershell 使用.Net对象发送邮件

Improvement of rate limit for laravel8 update

阿里云视频云技术专家 LVS 演讲全文:《“云端一体”的智能媒体生产制作演进之路》

How to cooperate with people in software development? |Daily anecdotes

I used Python to find out all the people who deleted my wechat and deleted them automatically

Shell uses. Net objects to send mail

Python basic syntax
随机推荐
We made a medical version of the MNIST dataset, and found that the common automl algorithm is not so easy to use
. net large data concurrency solution
“他,程序猿,35岁,被劝退”:不要只懂代码,会说话,胜过10倍默默努力
应届生年薪35w+ !倒挂老员工,互联网大厂薪资为何越来越高?
技术总监7年总结,如何进行正确的沟通?
Research on WLAN direct connection (peer-to-peer connection or P2P) and cross platform research of IOS
基于阿里云日志服务快速打造简版业务监控看板
原创 | 数据资产确权浅议
WLAN 直连(对等连接或 P2P)调研及iOS跨平台调研
Flink从入门到真香(3、从集合和文件中读取数据)
How to solve the difference between NAT IP and port IP
PMP心得分享
在51CTO学院Get到PMP证书
Gopherchina 2020 Conference
Eight ways to optimize if else code
【Python 1-6】Python教程之——数字
OR Talk NO.19 | Facebook田渊栋博士:基于蒙特卡洛树搜索的隐动作集黑盒优化 - 知乎
学习记录并且简单分析
喝汽水,1瓶汽水1元,2个空瓶可以换一瓶汽水,给20元,可以多少汽水
谷歌开源能翻译101种语言的AI模型,只比Facebook多一种