The wrapper for the primitive type long. As with the specification, this implementation relies on code laid out in Henry S. Warren, Jr.'s Hacker's Delight, (Addison Wesley, 2002) as well as The Aggregate's
| 29 | * @since 1.0 |
| 30 | */ |
| 31 | public final class Long extends Number implements Comparable<Long> { |
| 32 | |
| 33 | private static final long serialVersionUID = 4290774380558885855L; |
| 34 | |
| 35 | /** |
| 36 | * The value which the receiver represents. |
| 37 | */ |
| 38 | private final long value; |
| 39 | |
| 40 | /** |
| 41 | * Constant for the maximum {@code long} value, 2<sup>63</sup>-1. |
| 42 | */ |
| 43 | public static final long MAX_VALUE = 0x7FFFFFFFFFFFFFFFL; |
| 44 | |
| 45 | /** |
| 46 | * Constant for the minimum {@code long} value, -2<sup>63</sup>. |
| 47 | */ |
| 48 | public static final long MIN_VALUE = 0x8000000000000000L; |
| 49 | |
| 50 | /** |
| 51 | * The {@link Class} object that represents the primitive type {@code long}. |
| 52 | */ |
| 53 | @SuppressWarnings("unchecked") |
| 54 | public static final Class<Long> TYPE = (Class<Long>) new long[0].getClass() |
| 55 | .getComponentType(); |
| 56 | |
| 57 | // Note: This can't be set to "long.class", since *that* is |
| 58 | // defined to be "java.lang.Long.TYPE"; |
| 59 | |
| 60 | /** |
| 61 | * Constant for the number of bits needed to represent a {@code long} in |
| 62 | * two's complement form. |
| 63 | * |
| 64 | * @since 1.5 |
| 65 | */ |
| 66 | public static final int SIZE = 64; |
| 67 | |
| 68 | |
| 69 | /** |
| 70 | * Constructs a new {@code Long} with the specified primitive long value. |
| 71 | * |
| 72 | * @param value |
| 73 | * the primitive long value to store in the new instance. |
| 74 | */ |
| 75 | public Long(long value) { |
| 76 | this.value = value; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Constructs a new {@code Long} from the specified string. |
| 81 | * |
| 82 | * @param string |
| 83 | * the string representation of a long value. |
| 84 | * @throws NumberFormatException |
| 85 | * if {@code string} can not be decoded into a long value. |
| 86 | * @see #parseLong(String) |
| 87 | */ |
| 88 | public Long(String string) throws NumberFormatException { |
nothing calls this directly
no test coverage detected