当前位置:网站首页>学习记录并且简单分析
学习记录并且简单分析
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
边栏推荐
- Blockchain weekly: the development of digital currency is written into the 14th five year plan; Biden invited senior adviser of MIT digital currency program to join the presidential transition team; V
- PMP experience sharing
- We made a medical version of the MNIST dataset, and found that the common automl algorithm is not so easy to use
- I used Python to find out all the people who deleted my wechat and deleted them automatically
- 用科技赋能教育创新与重构 华为将教育信息化落到实处
- Flink从入门到真香(6、Flink实现UDF函数-实现更细粒度的控制流)
- How to solve the difference between NAT IP and port IP
- 京东落地DevOps平台时爆发的冲突如何解决?
- The first open source Chinese Bert pre training model in the financial field
- On the software of express delivery cabinet and deposit cabinet under Windows
猜你喜欢
Comics: looking for the best time to buy and sell stocks
I used Python to find out all the people who deleted my wechat and deleted them automatically
I used Python to find out all the people who deleted my wechat and deleted them automatically
[Python 1-6] Python tutorial 1 -- number
小米、OPPO在欧洲市场继续飙涨,小米更是直逼苹果
C++的那些事儿:从电饭煲到火箭,C++无处不在
This time Kwai tiktok is faster than shaking.
Rust: performance test criteria Library
.NET 大数据量并发解决方案
PMP考试通过心得分享
随机推荐
浅谈,盘点历史上有哪些著名的电脑病毒,80%的人都不知道!
Flink: from introduction to Zhenxiang (6. Flink implements UDF function - realizes more fine-grained control flow)
重返全球第三,小米做对了什么?
laravel8更新之维护模式改进
On the software of express delivery cabinet and deposit cabinet under Windows
Huawei has an absolute advantage in the 5g mobile phone market, and the market share of Xiaomi is divided by the market survey organization
DeepMind 最新论文解读:首次提出离散概率树中的因果推理算法
[Python 1-6] Python tutorial 1 -- number
数据库连接报错之IO异常(The Network Adapter could not establish the connection)
This year's salary is 35W +! Why is the salary of Internet companies getting higher and higher?
应届生年薪35w+ !倒挂老员工,互联网大厂薪资为何越来越高?
AI weekly: employees are allowed to voluntarily reduce salary; company response: employees are happy and satisfied; tiger tooth HR takes employees out of the company; Sweden forbids Huawei ZTE 5g equi
Flink从入门到真香(6、Flink实现UDF函数-实现更细粒度的控制流)
How to write a resume and project
Flink从入门到真香(10、Sink数据输出-Elasticsearch)
python基础教程python opencv pytesseract 验证码识别的实现
Ali tear off the e-commerce label
Alibaba cloud accelerates its growth and further consolidates its leading edge
浅谈单调栈
Introduction to mongodb foundation of distributed document storage database