Home | History | Annotate | Download | only in lang

Lines Matching defs:Short

30  * The {@code Short} class wraps a value of primitive type {@code
31 * short} in an object. An object of type {@code Short} contains a
32 * single field whose type is {@code short}.
35 * a {@code short} to a {@code String} and a {@code String} to a
36 * {@code short}, as well as other constants and methods useful when
37 * dealing with a {@code short}.
44 public final class Short extends Number implements Comparable<Short> {
47 * A constant holding the minimum value a {@code short} can
50 public static final short MIN_VALUE = -32768;
53 * A constant holding the maximum value a {@code short} can
56 public static final short MAX_VALUE = 32767;
60 * {@code short}.
62 public static final Class<Short> TYPE = (Class<Short>) short[].class.getComponentType();
66 * specified {@code short}. The radix is assumed to be 10.
68 * @param s the {@code short} to be converted
69 * @return the string representation of the specified {@code short}
72 public static String toString(short s) {
77 * Parses the string argument as a signed {@code short} in the
85 * indicate a positive value. The resulting {@code short} value
105 * {@code short}.
109 * {@code short} representation to be parsed
111 * @return the {@code short} represented by the string
114 * does not contain a parsable {@code short}.
116 public static short parseShort(String s, int radix)
122 return (short)i;
127 * short}. The characters in the string must all be decimal
132 * resulting {@code short} value is returned, exactly as if the
136 * @param s a {@code String} containing the {@code short}
138 * @return the {@code short} value represented by the
141 * contain a parsable {@code short}.
143 public static short parseShort(String s) throws NumberFormatException {
148 * Returns a {@code Short} object holding the value
151 * is interpreted as representing a signed {@code short} in
154 * int)} method. The result is a {@code Short} object that
155 * represents the {@code short} value specified by the string.
157 * <p>In other words, this method returns a {@code Short} object
161 * {@code new Short(Short.parseShort(s, radix))}
166 * @return a {@code Short} object holding the value
170 * not contain a parsable {@code short}.
172 public static Short valueOf(String s, int radix)
178 * Returns a {@code Short} object holding the
181 * {@code short}, exactly as if the argument were given to
183 * a {@code Short} object that represents the
184 * {@code short} value specified by the string.
186 * <p>In other words, this method returns a {@code Short} object
190 * {@code new Short(Short.parseShort(s))}
194 * @return a {@code Short} object holding the value
197 * not contain a parsable {@code short}.
199 public static Short valueOf(String s) throws NumberFormatException {
206 static final Short cache[] = new Short[-(-128) + 127 + 1];
210 cache[i] = new Short((short)(i - 128));
215 * Returns a {@code Short} instance representing the specified
216 * {@code short} value.
217 * If a new {@code Short} instance is not required, this method
219 * {@link #Short(short)}, as this method is likely to yield
226 * @param s a short value.
227 * @return a {@code Short} instance representing {@code s}.
230 public static Short valueOf(short s) {
236 return new Short(s);
240 * Decodes a {@code String} into a {@code Short}.
267 * Short.parseShort} method with the indicated radix (10, 16, or
275 * @return a {@code Short} object holding the {@code short}
278 * contain a parsable {@code short}.
279 * @see java.lang.Short#parseShort(java.lang.String, int)
281 public static Short decode(String nm) throws NumberFormatException {
286 return valueOf((short)i);
290 * The value of the {@code Short}.
294 private final short value;
297 * Constructs a newly allocated {@code Short} object that
298 * represents the specified {@code short} value.
301 * {@code Short}.
303 public Short(short value) {
308 * Constructs a newly allocated {@code Short} object that
309 * represents the {@code short} value indicated by the
311 * {@code short} value in exactly the manner used by the
315 * {@code Short}
317 * does not contain a parsable {@code short}.
318 * @see java.lang.Short#parseShort(java.lang.String, int)
320 public Short(String s) throws NumberFormatException {
325 * Returns the value of this {@code Short} as a
333 * Returns the value of this {@code Short} as a
334 * {@code short}.
336 public short shortValue() {
341 * Returns the value of this {@code Short} as an
349 * Returns the value of this {@code Short} as a
357 * Returns the value of this {@code Short} as a
365 * Returns the value of this {@code Short} as a
374 * {@code Short}'s value. The value is converted to signed
376 * the {@code short} value were given as an argument to the
377 * {@link java.lang.Short#toString(short)} method.
387 * Returns a hash code for this {@code Short}; equal to the result
390 * @return a hash code value for this {@code Short}
393 return Short.hashCode(value);
397 * Returns a hash code for a {@code short} value; compatible with
398 * {@code Short.hashCode()}.
401 * @return a hash code value for a {@code short} value.
404 public static int hashCode(short value) {
411 * {@code null} and is a {@code Short} object that
412 * contains the same {@code short} value as this object.
419 if (obj instanceof Short) {
420 return value == ((Short)obj).shortValue();
426 * Compares two {@code Short} objects numerically.
428 * @param anotherShort the {@code Short} to be compared.
429 * @return the value {@code 0} if this {@code Short} is
430 * equal to the argument {@code Short}; a value less than
431 * {@code 0} if this {@code Short} is numerically less
432 * than the argument {@code Short}; and a value greater than
433 * {@code 0} if this {@code Short} is numerically
434 * greater than the argument {@code Short} (signed
438 public int compareTo(Short anotherShort) {
443 * Compares two {@code short} values numerically.
446 * ShortShort.valueOf(y))
449 * @param x the first {@code short} to compare
450 * @param y the second {@code short} to compare
456 public static int compare(short x, short y) {
461 * The number of bits used to represent a {@code short} value in two's
468 * The number of bytes used to represent a {@code short} value in two's
477 * two's complement representation of the specified {@code short} value.
480 * the bytes in the specified {@code short} value.
483 public static short reverseBytes(short i) {
484 return (short) (((i & 0xFF00) >> 8) | (i << 8));