77 |
public static final Class TYPE = VMClassLoader.getPrimitiveClass('S'); |
public static final Class TYPE = VMClassLoader.getPrimitiveClass('S'); |
78 |
|
|
79 |
/** |
/** |
80 |
|
* The number of bits needed to represent a <code>short</code>. |
81 |
|
* @since 1.5 |
82 |
|
*/ |
83 |
|
public static final int SIZE = 16; |
84 |
|
|
85 |
|
// This caches some Short values, and is used by boxing conversions |
86 |
|
// via valueOf(). We must cache at least -128..127; these constants |
87 |
|
// control how much we actually cache. |
88 |
|
private static final int MIN_CACHE = -128; |
89 |
|
private static final int MAX_CACHE = 127; |
90 |
|
private static Short[] shortCache = new Short[MAX_CACHE - MIN_CACHE + 1]; |
91 |
|
|
92 |
|
/** |
93 |
* The immutable value of this Short. |
* The immutable value of this Short. |
94 |
* |
* |
95 |
* @serial the wrapped short |
* @serial the wrapped short |
363 |
{ |
{ |
364 |
return compareTo((Short)o); |
return compareTo((Short)o); |
365 |
} |
} |
366 |
|
|
367 |
|
/** |
368 |
|
* Reverse the bytes in val. |
369 |
|
* @since 1.5 |
370 |
|
*/ |
371 |
|
public static short reverseBytes(short val) |
372 |
|
{ |
373 |
|
return (short) (((val >> 8) & 0xff) | ((val << 8) & 0xff00)); |
374 |
|
} |
375 |
} |
} |