源码浅分析
勿以浮沙筑高台ing
这个作者很懒,什么都没留下…
展开
-
实现Integer方法中的valueOf功能,不能使用字符串转换整数的库函数
实现Integer方法中的valueOf功能,不能使用字符串转换整数的库函数 ## valueOf功能实现 要求:判断是否是数字,如果不是数字,返回0 (1)方法实现1: 原理如下:使用正则来判断是否是数字,然后遍历数字,由前到后去10指数幂相加 代码如下: public int str2Int(String str){ int a = 0; int isplus = 1; if(st...原创 2019-04-04 15:31:59 · 531 阅读 · 1 评论 -
Integer方法中的valueOf源码分析
Integer方法中的valueOf源码分析 valueOf 源码如下: public static Integer valueOf(int i) { if (i >= IntegerCache.low && i <= IntegerCache.high) return IntegerCache.cache[i + (-IntegerCache.low)]; retur...原创 2019-04-03 16:48:30 · 400 阅读 · 1 评论