1 *java.lang.Short* *Short* The Short class wraps a value of primitive type
4 public final class Short
5 extends |java.lang.Number|
6 implements |java.lang.Comparable|
8 |java.lang.Short_Description|
9 |java.lang.Short_Fields|
10 |java.lang.Short_Constructors|
11 |java.lang.Short_Methods|
13 ================================================================================
15 *java.lang.Short_Fields*
16 |short_java.lang.Short.MAX_VALUE|
17 |short_java.lang.Short.MIN_VALUE|
18 |int_java.lang.Short.SIZE|
19 |java.lang.Class<java.lang.Short>_java.lang.Short.TYPE|
21 *java.lang.Short_Constructors*
22 |java.lang.Short(short)|Constructs a newly allocated Short object that represe
23 |java.lang.Short(String)|Constructs a newly allocated Short object that repres
25 *java.lang.Short_Methods*
26 |java.lang.Short.byteValue()|Returns the value of this Short as a byte.
27 |java.lang.Short.compareTo(Short)|Compares two Short objects numerically.
28 |java.lang.Short.decode(String)|Decodes a String into a Short.
29 |java.lang.Short.doubleValue()|Returns the value of this Short as a double.
30 |java.lang.Short.equals(Object)|Compares this object to the specified object.
31 |java.lang.Short.floatValue()|Returns the value of this Short as a float.
32 |java.lang.Short.hashCode()|Returns a hash code for this Short.
33 |java.lang.Short.intValue()|Returns the value of this Short as an int.
34 |java.lang.Short.longValue()|Returns the value of this Short as a long.
35 |java.lang.Short.parseShort(String)|Parses the string argument as a signed deci
36 |java.lang.Short.parseShort(String,int)|Parses the string argument as a signed
37 |java.lang.Short.reverseBytes(short)|Returns the value obtained by reversing th
38 |java.lang.Short.shortValue()|Returns the value of this Short as a short.
39 |java.lang.Short.toString()|Returns a String object representing this Short's
40 |java.lang.Short.toString(short)|Returns a new String object representing the
41 |java.lang.Short.valueOf(short)|Returns a Short instance representing the speci
42 |java.lang.Short.valueOf(String)|Returns a Short object holding the value give
43 |java.lang.Short.valueOf(String,int)|Returns a Short object holding the value
45 *java.lang.Short_Description*
47 The Short class wraps a value of primitive type short in an object. An object
48 of type Short contains a single field whose type is short.
52 In addition, this class provides several methods for converting a short to a
53 String and a String to a short, as well as other constants and methods useful
54 when dealing with a short.
58 *short_java.lang.Short.MAX_VALUE*
60 A constant holding the maximum value a short can have, 215-1.
63 *short_java.lang.Short.MIN_VALUE*
65 A constant holding the minimum value a short can have, -215.
68 *int_java.lang.Short.SIZE*
70 The number of bits used to represent a short value in two's complement binary
74 *java.lang.Class<java.lang.Short>_java.lang.Short.TYPE*
76 The Class instance representing the primitive type short.
80 *java.lang.Short(short)*
82 public Short(short value)
84 Constructs a newly allocated Short object that represents the specified short
87 value - the value to be represented by the Short.
89 *java.lang.Short(String)*
91 public Short(java.lang.String s)
92 throws |java.lang.NumberFormatException|
94 Constructs a newly allocated Short object that represents the short value
95 indicated by the String parameter. The string is converted to a short value in
96 exactly the manner used by the parseShort method for radix 10.
98 s - the String to be converted to a Short
100 *java.lang.Short.byteValue()*
102 public byte byteValue()
104 Returns the value of this Short as a byte.
108 *java.lang.Short.compareTo(Short)*
110 public int compareTo(java.lang.Short anotherShort)
112 Compares two Short objects numerically.
115 anotherShort - the Short to be compared.
117 Returns: the value 0 if this Short is equal to the argument Short; a value less than 0
118 if this Short is numerically less than the argument Short; and a
119 value greater than 0 if this Short is numerically greater than the
120 argument Short (signed comparison).
122 *java.lang.Short.decode(String)*
124 public static |java.lang.Short| decode(java.lang.String nm)
125 throws |java.lang.NumberFormatException|
127 Decodes a String into a Short. Accepts decimal, hexadecimal, and octal numbers
128 given by the following grammar:
132 DecodableString: Signopt DecimalNumeral Signopt 0x HexDigits Signopt 0X
133 HexDigits Signopt # HexDigits Signopt 0 OctalDigits
139 DecimalNumeral, HexDigits, and OctalDigits are defined in 3.10.1 of the Java
140 Language Specification.
142 The sequence of characters following an (optional) negative sign and/or radix
143 specifier (0x, 0X, #, or leading zero) is parsed as by the Short.parseShort
144 method with the indicated radix (10, 16, or 8). This sequence of characters
145 must represent a positive value or a (|java.lang.NumberFormatException|) will
146 be thrown. The result is negated if first character of the specified String is
147 the minus sign. No whitespace characters are permitted in the String.
150 nm - the String to decode.
152 Returns: a Short object holding the short value represented by nm
154 *java.lang.Short.doubleValue()*
156 public double doubleValue()
158 Returns the value of this Short as a double.
162 *java.lang.Short.equals(Object)*
164 public boolean equals(java.lang.Object obj)
166 Compares this object to the specified object. The result is true if and only if
167 the argument is not null and is a Short object that contains the same short
168 value as this object.
171 obj - the object to compare with
173 Returns: true if the objects are the same; false otherwise.
175 *java.lang.Short.floatValue()*
177 public float floatValue()
179 Returns the value of this Short as a float.
183 *java.lang.Short.hashCode()*
185 public int hashCode()
187 Returns a hash code for this Short.
191 *java.lang.Short.intValue()*
193 public int intValue()
195 Returns the value of this Short as an int.
199 *java.lang.Short.longValue()*
201 public long longValue()
203 Returns the value of this Short as a long.
207 *java.lang.Short.parseShort(String)*
209 public static short parseShort(java.lang.String s)
210 throws |java.lang.NumberFormatException|
212 Parses the string argument as a signed decimal short. The characters in the
213 string must all be decimal digits, except that the first character may be an
214 ASCII minus sign '-' ('u002D') to indicate a negative value. The resulting
215 short value is returned, exactly as if the argument and the radix 10 were given
216 as arguments to the (|java.lang.Short|) method.
219 s - a String containing the short representation to be parsed
221 Returns: the short value represented by the argument in decimal.
223 *java.lang.Short.parseShort(String,int)*
225 public static short parseShort(
228 throws |java.lang.NumberFormatException|
230 Parses the string argument as a signed short in the radix specified by the
231 second argument. The characters in the string must all be digits, of the
232 specified radix (as determined by whether (|java.lang.Character|) returns a
233 nonnegative value) except that the first character may be an ASCII minus sign
234 '-' ('u002D') to indicate a negative value. The resulting byte value is
237 An exception of type NumberFormatException is thrown if any of the following
240 The first argument is null or is a string of length zero.
242 The radix is either smaller than (|java.lang.Character|) or larger than
243 (|java.lang.Character|) .
245 Any character of the string is not a digit of the specified radix, except that
246 the first character may be a minus sign '-' ('u002D') provided that the string
247 is longer than length 1.
249 The value represented by the string is not a value of type short.
252 s - the String containing the short representation to be parsed
253 radix - the radix to be used while parsing s
255 Returns: the short represented by the string argument in the specified radix.
257 *java.lang.Short.reverseBytes(short)*
259 public static short reverseBytes(short i)
261 Returns the value obtained by reversing the order of the bytes in the two's
262 complement representation of the specified short value.
266 Returns: the value obtained by reversing (or, equivalently, swapping) the bytes in the
267 specified short value.
269 *java.lang.Short.shortValue()*
271 public short shortValue()
273 Returns the value of this Short as a short.
277 *java.lang.Short.toString()*
279 public |java.lang.String| toString()
281 Returns a String object representing this Short's value. The value is converted
282 to signed decimal representation and returned as a string, exactly as if the
283 short value were given as an argument to the (|java.lang.Short|) method.
287 Returns: a string representation of the value of this object in base10.
289 *java.lang.Short.toString(short)*
291 public static |java.lang.String| toString(short s)
293 Returns a new String object representing the specified short. The radix is
297 s - the short to be converted
299 Returns: the string representation of the specified short
301 *java.lang.Short.valueOf(short)*
303 public static |java.lang.Short| valueOf(short s)
305 Returns a Short instance representing the specified short value. If a new Short
306 instance is not required, this method should generally be used in preference to
307 the constructor (|java.lang.Short|) , as this method is likely to yield
308 significantly better space and time performance by caching frequently requested
314 Returns: a Short instance representing s.
316 *java.lang.Short.valueOf(String)*
318 public static |java.lang.Short| valueOf(java.lang.String s)
319 throws |java.lang.NumberFormatException|
321 Returns a Short object holding the value given by the specified String. The
322 argument is interpreted as representing a signed decimal short, exactly as if
323 the argument were given to the (|java.lang.Short|) method. The result is a
324 Short object that represents the short value specified by the string. In other
325 words, this method returns a Byte object equal to the value of:
327 new Short(Short.parseShort(s))
330 s - the string to be parsed
332 Returns: a Short object holding the value represented by the string argument
334 *java.lang.Short.valueOf(String,int)*
336 public static |java.lang.Short| valueOf(
339 throws |java.lang.NumberFormatException|
341 Returns a Short object holding the value extracted from the specified String
342 when parsed with the radix given by the second argument. The first argument is
343 interpreted as representing a signed short in the radix specified by the second
344 argument, exactly as if the argument were given to the (|java.lang.Short|)
345 method. The result is a Short object that represents the short value specified
346 by the string. In other words, this method returns a Short object equal to the
349 new Short(Short.parseShort(s, radix))
352 s - the string to be parsed
353 radix - the radix to be used in interpreting s
355 Returns: a Short object holding the value represented by the string argument in the