Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public final class Short
ImplementsComparable<Short>
The Short class is the standard wrapper for short values.
Since: JDK1.1, CLDC 1.0
Fields
public static final short MAX_VALUE = 32767 | The maximum value a Short can have. |
public static final short MIN_VALUE = -32768 | The minimum value a Short can have. |
public static final Class<Short> TYPE | |
public static final int BYTES = 2 | The size of a short in bytes. |
public static final int SIZE = 16 | The size of a short in bits. |
Constructors
public Short(short value) | Constructs a Short object initialized to the specified short value. |
public Short(String s)
throws NumberFormatException | Deprecated A Short of parseShort(s). |
Methods
Inherited methods
Field details
MAX_VALUE
public static final short MAX_VALUE = 32767The maximum value a Short can have.
See Also:Constant Field Values
MIN_VALUE
public static final short MIN_VALUE = -32768The minimum value a Short can have.
See Also:Constant Field Values
TYPE
public static final Class<Short> TYPEBYTES
public static final int BYTES = 2The size of a short in bytes.
SIZE
public static final int SIZE = 16The size of a short in bits.
Constructor details
Short
public Short(short value)Constructs a Short object initialized to the specified short value.
value - the initial value of the Short
Short
public Short(String s)
throws NumberFormatExceptionDeprecated.
A Short of
parseShort(s).Throws
Method details
equals
public boolean equals(Object obj)Compares this object to the specified object.
hashCode
public int hashCode()Returns a hashcode for this Short.
parseShort
public static short parseShort(String s)
throws NumberFormatExceptionAssuming 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
parseShort
public static short parseShort(String s, int radix)
throws NumberFormatExceptionAssuming 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
shortValue
public short shortValue()Returns the value of this Short as a short.
toString
public String toString()Returns a String object representing this Short’s value.
valueOf
public static Short valueOf(short i)Returns the object instance of i
Parameters
ishort- the primitive
Returns
object instance
intValue
public int intValue()longValue
public long longValue()floatValue
public float floatValue()doubleValue
public double doubleValue()compareTo
public int compareTo(Short another)Compares this object to the specified object to determine their relative
order.
Parameters
anotherShort- 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 than
another; 0 if this instance has the same order as
another.Throws
ClassCastException- if
anothercannot be converted into something comparable tothisinstance.
compare
public static int compare(short s1, short s2)toString
public static String toString(short s)The decimal string of
s.valueOf
public static Short valueOf(String s)
throws NumberFormatExceptionA Short of
parseShort(s).Throws
valueOf
public static Short valueOf(String s, int radix)
throws NumberFormatExceptionA Short of
parseShort(s, radix).Throws
decode
public static Short decode(String nm)
throws NumberFormatExceptionDecodes a decimal, hexadecimal or octal short, as
Integer.decode.Throws
hashCode
public static int hashCode(short value)The value itself.
compareUnsigned
public static int compareUnsigned(short x, short y)Compares the two as unsigned values.
toUnsignedInt
public static int toUnsignedInt(short x)The value as an unsigned int.
toUnsignedLong
public static long toUnsignedLong(short x)The value as an unsigned long.
reverseBytes
public static short reverseBytes(short i)The bytes in reverse order.