Class Short
java.lang.Object
java.lang.Number
java.lang.Short
- All Implemented Interfaces:
Comparable<Short>
The Short class is the standard wrapper for short values.
Since: JDK1.1, CLDC 1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionShort(short value) Constructs a Short object initialized to the specified short value. -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompare(short s1, short s2) intCompares this object to the specified object to determine their relative order.doublebooleanCompares this object to the specified object.floatinthashCode()Returns a hashcode for this Short.intintValue()longstatic shortparseShort(String s) Assuming the specified String represents a short, returns that short's value.static shortparseShort(String s, int radix) Assuming the specified String represents a short, returns that short's value in the radix specified by the second argument.shortReturns the value of this Short as a short.toString()Returns a String object representing this Short's value.static ShortvalueOf(short i) Returns the object instance of i
-
Field Details
-
MAX_VALUE
public static final short MAX_VALUEThe maximum value a Short can have. See Also:Constant Field Values- See Also:
-
MIN_VALUE
public static final short MIN_VALUEThe minimum value a Short can have. See Also:Constant Field Values- See Also:
-
-
Constructor Details
-
Short
public Short(short value) Constructs a Short object initialized to the specified short value. value - the initial value of the Short
-
-
Method Details
-
equals
-
hashCode
-
parseShort
Assuming the specified String represents a short, returns that short's value. Throws an exception if the String cannot be parsed as a short. The radix is assumed to be 10.- Throws:
NumberFormatException
-
parseShort
Assuming the specified String represents a short, returns that short's value in the radix specified by the second argument. Throws an exception if the String cannot be parsed as a short.- Throws:
NumberFormatException
-
shortValue
public short shortValue()Returns the value of this Short as a short.- Overrides:
shortValuein classNumber
-
toString
-
valueOf
Returns the object instance of i- Parameters:
i- the primitive- Returns:
- object instance
-
intValue
-
longValue
-
floatValue
public float floatValue()- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValuein classNumber
-
compareTo
Description copied from interface:ComparableCompares this object to the specified object to determine their relative order.- Specified by:
compareToin interfaceComparable<Short>- Parameters:
another- the object to compare to this instance.- Returns:
- a negative integer if this instance is less than
another; a positive integer if this instance is greater thananother; 0 if this instance has the same order asanother.
-
compare
public static int compare(short s1, short s2)
-