日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

源码看JAVA【十】Short

發(fā)布時間:2023/12/16 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 源码看JAVA【十】Short 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1、最大值與最小值

/*** A constant holding the minimum value a {@code short} can* have, -2<sup>15</sup>.*/public static final short MIN_VALUE = -32768;/*** A constant holding the maximum value a {@code short} can* have, 2<sup>15</sup>-1.*/public static final short MAX_VALUE = 32767;

2、ShortCache

定義緩存-128~127

private static class ShortCache {private ShortCache(){}static final Short cache[] = new Short[-(-128) + 127 + 1];static {for(int i = 0; i < cache.length; i++)cache[i] = new Short((short)(i - 128));}}

3、hashCode與equals

返回相應(yīng)的short值

/*** Returns a hash code for a {@code short} value; compatible with* {@code Short.hashCode()}.** @param value the value to hash* @return a hash code value for a {@code short} value.* @since 1.8*/public static int hashCode(short value) {return (int)value;}/*** Compares this object to the specified object. The result is* {@code true} if and only if the argument is not* {@code null} and is a {@code Short} object that* contains the same {@code short} value as this object.** @param obj the object to compare with* @return {@code true} if the objects are the same;* {@code false} otherwise.*/public boolean equals(Object obj) {if (obj instanceof Short) {return value == ((Short)obj).shortValue();}return false;}

4、其余與Integer功能類似

總結(jié)

以上是生活随笔為你收集整理的源码看JAVA【十】Short的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。