当前位置:网站首页>学习记录并且简单分析
学习记录并且简单分析
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
边栏推荐
- 漫画:寻找股票买入卖出的最佳时机(整合版)
- Golang ICMP Protocol detects viable hosts
- Interpretation of deepmind's latest paper: the causal reasoning algorithm in discrete probability tree is proposed for the first time
- Or talk No.19 | Facebook Dr. Tian Yuandong: black box optimization of hidden action set based on Monte Carlo tree search
- Flink: from introduction to Zhenxiang (3. Reading data from collection and file)
- 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
- Improvement of maintenance mode of laravel8 update
- Golang ICMP协议探测存活主机
- The progress bar written in Python is so wonderful~
- laravel8更新之维护模式改进
猜你喜欢

CSP考试须知与各种小技巧

漫画:寻找股票买入卖出的最佳时机(整合版)

Returning to the third place in the world, what did Xiaomi do right?

Enabling education innovation and reconstruction with science and technology Huawei implements education informatization

Huawei has an absolute advantage in the 5g mobile phone market, and the market share of Xiaomi is divided by the market survey organization

10 common software architecture patterns

Ali tear off the e-commerce label

华为云重大变革:Cloud&AI 升至华为第四大 BG ,火力全开

我用 Python 找出了删除我微信的所有人并将他们自动化删除了

Implementation of verification code recognition in Python opencv pytesseract
随机推荐
B站stm32视频学习
Python basic syntax
Millet and oppo continue to soar in the European market, and Xiaomi is even closer to apple
AQS解析
How to solve the conflict when JD landed on Devops platform?
Golang 系统ping程序探测存活主机(任意权限)
laravel8更新之维护模式改进
nat转换的ip跟端口ip不相同的解决方法
数据库连接报错之IO异常(The Network Adapter could not establish the connection)
模板引擎的整理归纳
喜获蚂蚁offer,定级p7,面经分享,万字长文带你走完面试全过程
喝汽水,1瓶汽水1元,2个空瓶可以换一瓶汽水,给20元,可以多少汽水
Examples of unconventional aggregation
Eight ways to optimize if else code
Powershell 使用.Net对象发送邮件
[Python 1-6] Python tutorial 1 -- number
3、 The parameters of the function
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
浅谈单调栈
I used Python to find out all the people who deleted my wechat and deleted them automatically