当前位置:网站首页>学习记录并且简单分析
学习记录并且简单分析
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
边栏推荐
- Gopherchina 2020 Conference
- 擅长To C的腾讯,如何借腾讯云在这几个行业云市场占有率第一?
- Flink: from introduction to Zhenxiang (6. Flink implements UDF function - realizes more fine-grained control flow)
- Interpretation of deepmind's latest paper: the causal reasoning algorithm in discrete probability tree is proposed for the first time
- 适合c/c++新手学习的一些项目,别给我错过了!
- Restfulapi learning notes -- father son resources (4)
- “他,程序猿,35岁,被劝退”:不要只懂代码,会说话,胜过10倍默默努力
- [Python 1-6] Python tutorial 1 -- number
- 漫画:寻找股票买入卖出的最佳时机(整合版)
- 啥是数据库范式
猜你喜欢
Dev-c++在windows环境下无法debug(调试)的解决方案
阿里云加速增长,进一步巩固领先优势
大龄程序员没有出路吗?
Xiaoqingtai officially set foot on the third day of no return
nat转换的ip跟端口ip不相同的解决方法
小青台正式踏上不归路的第3天
We made a medical version of the MNIST dataset, and found that the common automl algorithm is not so easy to use
LeanCloud 十月变化
阿里撕下电商标签
阿里云视频云技术专家 LVS 演讲全文:《“云端一体”的智能媒体生产制作演进之路》
随机推荐
Golang ICMP Protocol detects viable hosts
谷歌开源能翻译101种语言的AI模型,只比Facebook多一种
小青台正式踏上不归路的第3天
Interpretation of deepmind's latest paper: the causal reasoning algorithm in discrete probability tree is proposed for the first time
2035我们将建成这样的国家
Enabling education innovation and reconstruction with science and technology Huawei implements education informatization
阿里云加速增长,进一步巩固领先优势
Restfulapi learning notes -- father son resources (4)
From a friend recently Ali, Tencent, meituan and other P7 Python development post interview questions
Do these mistakes in your resume affect your annual salary of one million?
用 Python 写出来的进度条,竟如此美妙~
The network adapter could not establish the connection
RestfulApi 学习笔记——父子资源(四)
Comics: looking for the best time to buy and sell stocks
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
wanxin finance
Is there no way out for older programmers?
新型存算一体芯片诞生,利好人工智能应用~
DeepMind 最新论文解读:首次提出离散概率树中的因果推理算法
wanxin finance