Short
class wraps a value of primitive type short
in an object. An object of type Short
contains a
single field whose type is short
.
In addition, this class provides several methods for converting
a short
to a String
and a String
to a
short
, as well as other constants and methods useful when
dealing with a short
.
This is a value-based class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail.
java.lang.Number
Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
public static final int | BYTES
The number of bytes used to represent a |
public static final short | MAX_VALUE
A constant holding the maximum value a |
public static final short | MIN_VALUE
A constant holding the minimum value a |
private static final long | serialVersionUID
use serialVersionUID from JDK 1.1.
|
public static final int | SIZE
The number of bits used to represent a |
public static final Class | TYPE
The |
private final short | value
The value of the |
Access | Constructor and Description |
---|---|
public | Short(short
the value to be represented by the
value)Short .
Deprecated
for removal since 9. It is rarely appropriate to use this constructor.
Constructs a newly allocated |
public |
Modifier and Type | Method and Description |
---|---|
public byte | byteValue()
Overrides java. Returns the value of this |
public static int | Returns: the value0 if x == y ;
a value less than 0 if x < y ; and
a value greater than 0 if x > y the first x, short short to comparethe second y)short to compareCompares two |
public int | Returns: the value0 if this Short is
equal to the argument Short ; a value less than
0 if this Short is numerically less
than the argument Short ; and a value greater than
0 if this Short is numerically
greater than the argument Short (signed
comparison).the anotherShort)Short to be compared.Implements java. Compares two |
public static int | Returns: the value0 if x == y ; a value less
than 0 if x < y as unsigned values; and
a value greater than 0 if x > y as
unsigned valuesthe first x, short short to comparethe second y)short to compareCompares two |
public static Short | |
public Optional | describeConstable()
Implements java. Returns an |
public double | doubleValue()
Implements abstract java. Returns the value of this |
public boolean | Returns: true if the objects are the same;
false otherwise.the object to compare with obj)Overrides java. Compares this object to the specified object. |
public float | floatValue()
Implements abstract java. Returns the value of this |
public int | Returns: a hash code value for thisShort Overrides java. Returns a hash code for this |
public static int | Returns: a hash code value for ashort value.the value to hash value)Returns a hash code for a |
public int | intValue()
Implements abstract java. Returns the value of this |
public long | longValue()
Implements abstract java. Returns the value of this |
public static short | Returns: theshort represented by the string
argument in the specified radix.the s, int String containing the
short representation to be parsedthe radix to be used while parsing radix)s Parses the string argument as a signed |
public static short | Returns: theshort value represented by the
argument in decimal.a s)String containing the short
representation to be parsedParses the string argument as a signed decimal |
public static short | Returns: the value obtained by reversing (or, equivalently, swapping) the bytes in the specifiedshort value.the value whose bytes are to be reversed i)Returns the value obtained by reversing the order of the bytes in the
two's complement representation of the specified |
public short | |
public static String | Returns: the string representation of the specifiedshort the s)short to be convertedReturns a new |
public String | Returns: a string representation of the value of this object in base 10.Overrides java. Returns a |
public static int | Returns: the argument converted toint by an unsigned
conversionthe value to convert to an unsigned x)int Converts the argument to an |
public static long | Returns: the argument converted tolong by an unsigned
conversionthe value to convert to an unsigned x)long Converts the argument to a |
public static Short | Returns: aShort object holding the value
represented by the string argument in the
specified radix.the string to be parsed s, int the radix to be used in interpreting radix)s Returns a |
public static Short | |
public static Short | Returns: aShort instance representing s .a short value. s)Returns a |
BYTES | back to summary |
---|---|
public static final int BYTES The number of bytes used to represent a
|
MAX_VALUE | back to summary |
---|---|
public static final short MAX_VALUE A constant holding the maximum value a |
MIN_VALUE | back to summary |
---|---|
public static final short MIN_VALUE A constant holding the minimum value a |
serialVersionUID | back to summary |
---|---|
private static final long serialVersionUID Hides java. use serialVersionUID from JDK 1.1. for interoperability |
SIZE | back to summary |
---|---|
public static final int SIZE The number of bits used to represent a
|
TYPE | back to summary |
---|---|
public static final Class<Short> TYPE The
|
value | back to summary |
---|---|
private final short value The value of the |
Short | back to summary |
---|---|
public Short(short value)
Deprecated for removal since 9. It is rarely appropriate to use this constructor. The static factory
Constructs a newly allocated
|
Short | back to summary |
---|---|
public Short(String s) throws NumberFormatException
Deprecated for removal since 9. It is rarely appropriate to use this constructor.
Use Constructs a newly allocated
|
byteValue | back to summary |
---|---|
public byte byteValue() Overrides java. Returns the value of this
|
compare | back to summary |
---|---|
public static int compare(short x, short y) Compares two Short.valueOf(x).compareTo(Short.valueOf(y))
|
compareTo | back to summary |
---|---|
public int compareTo(Short anotherShort) Implements java. Compares two
|
compareUnsigned | back to summary |
---|---|
public static int compareUnsigned(short x, short y) Compares two
|
decode | back to summary |
---|---|
public static Short decode(String nm) throws NumberFormatException Decodes a DecimalNumeral, HexDigits, and OctalDigits are as defined in section 3.10.1 of The Java Language Specification, except that underscores are not accepted between digits. The sequence of characters following an optional
sign and/or radix specifier ("
|
describeConstable | back to summary |
---|---|
public Optional Implements java. Returns an |
doubleValue | back to summary |
---|---|
public double doubleValue() Implements abstract java. Returns the value of this
|
equals | back to summary |
---|---|
public boolean equals(Object obj) Overrides java. Compares this object to the specified object. The result is
|
floatValue | back to summary |
---|---|
public float floatValue() Implements abstract java. Returns the value of this
|
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Returns a hash code for this
|
hashCode | back to summary |
---|---|
public static int hashCode(short value) Returns a hash code for a
|
intValue | back to summary |
---|---|
public int intValue() Implements abstract java. Returns the value of this
|
longValue | back to summary |
---|---|
public long longValue() Implements abstract java. Returns the value of this
|
parseShort | back to summary |
---|---|
public static short parseShort(String s, int radix) throws NumberFormatException Parses the string argument as a signed An exception of type
|
parseShort | back to summary |
---|---|
public static short parseShort(String s) throws NumberFormatException Parses the string argument as a signed decimal
|
reverseBytes | back to summary |
---|---|
public static short reverseBytes(short i) Returns the value obtained by reversing the order of the bytes in the
two's complement representation of the specified
|
shortValue | back to summary |
---|---|
public short shortValue() Overrides java. Returns the value of this
|
toString | back to summary |
---|---|
public static String toString(short s) Returns a new
|
toString | back to summary |
---|---|
public String toString() Overrides java. Returns a |
toUnsignedInt | back to summary |
---|---|
public static int toUnsignedInt(short x) Converts the argument to an
|
toUnsignedLong | back to summary |
---|---|
public static long toUnsignedLong(short x) Converts the argument to a
|
valueOf | back to summary |
---|---|
public static Short valueOf(String s, int radix) throws NumberFormatException Returns a In other words, this method returns a
|
valueOf | back to summary |
---|---|
public static Short valueOf(String s) throws NumberFormatException Returns a In other words, this method returns a
|
valueOf | back to summary |
---|---|
public static Short valueOf(short s) Returns a
|
Modifier and Type | Field and Description |
---|---|
pack-priv static Short[] | |
pack-priv static final Short[] |
Access | Constructor and Description |
---|---|
private |
archivedCache | back to summary |
---|---|
pack-priv static Short[] archivedCache |
cache | back to summary |
---|---|
pack-priv static final Short[] cache
|
ShortCache | back to summary |
---|---|
private ShortCache() |