The wrapper for the primitive type short. @see java.lang.Number @since 1.1
| 24 | * @since 1.1 |
| 25 | */ |
| 26 | public final class Short extends Number implements Comparable<Short> { |
| 27 | |
| 28 | private static final long serialVersionUID = 7515723908773894738L; |
| 29 | |
| 30 | /** |
| 31 | * The value which the receiver represents. |
| 32 | */ |
| 33 | private final short value; |
| 34 | |
| 35 | /** |
| 36 | * Constant for the maximum {@code short} value, 2<sup>15</sup>-1. |
| 37 | */ |
| 38 | public static final short MAX_VALUE = (short) 0x7FFF; |
| 39 | |
| 40 | /** |
| 41 | * Constant for the minimum {@code short} value, -2<sup>15</sup>. |
| 42 | */ |
| 43 | public static final short MIN_VALUE = (short) 0x8000; |
| 44 | |
| 45 | /** |
| 46 | * Constant for the number of bits needed to represent a {@code short} in |
| 47 | * two's complement form. |
| 48 | * |
| 49 | * @since 1.5 |
| 50 | */ |
| 51 | public static final int SIZE = 16; |
| 52 | |
| 53 | /** |
| 54 | * The {@link Class} object that represents the primitive type {@code |
| 55 | * short}. |
| 56 | */ |
| 57 | @SuppressWarnings("unchecked") |
| 58 | public static final Class<Short> TYPE = (Class<Short>) new short[0] |
| 59 | .getClass().getComponentType(); |
| 60 | |
| 61 | // Note: This can't be set to "short.class", since *that* is |
| 62 | // defined to be "java.lang.Short.TYPE"; |
| 63 | |
| 64 | |
| 65 | /** |
| 66 | * Constructs a new {@code Short} from the specified string. |
| 67 | * |
| 68 | * @param string |
| 69 | * the string representation of a short value. |
| 70 | * @throws NumberFormatException |
| 71 | * if {@code string} can not be decoded into a short value. |
| 72 | * @see #parseShort(String) |
| 73 | */ |
| 74 | public Short(String string) throws NumberFormatException { |
| 75 | this(parseShort(string)); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Constructs a new {@code Short} with the specified primitive short value. |
| 80 | * |
| 81 | * @param value |
| 82 | * the primitive short value to store in the new instance. |
| 83 | */ |
nothing calls this directly
no test coverage detected