Byte class is the wrapper class for values of the primitive
type byte. An object of type Byte contains a
single field whose type is byte.
In addition, this class provides several methods for converting
a byte to a String and a String to a byte, as well as other constants and methods useful when dealing
with a byte.
This is a value-based class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail.
java.lang.Number
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | BYTES
The number of bytes used to represent a |
| public static final byte | MAX_VALUE
A constant holding the maximum value a |
| public static final byte | MIN_VALUE
A constant holding the minimum value a |
| private static final long | serialVersionUID
use serialVersionUID from JDK 1.1.
|
| public static final int | SIZE
The number of bits used to represent a |
| public static final Class | TYPE
The |
| private final byte | value
The value of the |
| Access | Constructor and Description |
|---|---|
| public | Byte(byte
the value to be represented by the
value)Byte.
Deprecated
since 9. It is rarely appropriate to use this constructor.
Constructs a newly allocated |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public byte | |
| public static int | Returns: the value0 if x == y;
a value less than 0 if x < y; and
a value greater than 0 if x > ythe first x, byte byte to comparethe second y)byte to compareCompares two |
| public int | Returns: the value0 if this Byte is
equal to the argument Byte; a value less than
0 if this Byte is numerically less
than the argument Byte; and a value greater than
0 if this Byte is numerically
greater than the argument Byte (signed
comparison).the anotherByte)Byte to be compared.Implements java. Compares two |
| public static int | Returns: the value0 if x == y; a value less
than 0 if x < y as unsigned values; and
a value greater than 0 if x > y as
unsigned valuesthe first x, byte byte to comparethe second y)byte to compareCompares two |
| public static Byte | |
| public Optional | describeConstable()
Implements java. Returns an |
| public double | doubleValue()
Implements abstract java. Returns the value of this |
| public boolean | Returns: true if the objects are the same;
false otherwise.the object to compare with obj)Overrides java. Compares this object to the specified object. |
| public float | floatValue()
Implements abstract java. Returns the value of this |
| public int | Returns: a hash code value for thisByteOverrides java. Returns a hash code for this |
| public static int | Returns: a hash code value for abyte value.the value to hash value)Returns a hash code for a |
| public int | intValue()
Implements abstract java. Returns the value of this |
| public long | longValue()
Implements abstract java. Returns the value of this |
| public static byte | |
| public static byte | |
| public short | shortValue()
Overrides java. Returns the value of this |
| public static String | Returns: the string representation of the specifiedbytethe b)byte to be convertedReturns a new |
| public String | Returns: a string representation of the value of this object in base 10.Overrides java. Returns a |
| public static int | Returns: the argument converted toint by an unsigned
conversionthe value to convert to an unsigned x)intConverts the argument to an |
| public static long | Returns: the argument converted tolong by an unsigned
conversionthe value to convert to an unsigned x)longConverts the argument to a |
| public static Byte | Returns: aByte instance representing b.a byte value. b)Returns a |
| public static Byte | Returns: aByte object holding the value
represented by the string argument in the
specified radix.the string to be parsed s, int the radix to be used in interpreting radix)sReturns a |
| public static Byte |
| BYTES | back to summary |
|---|---|
| public static final int BYTES The number of bytes used to represent a
| |
| MAX_VALUE | back to summary |
|---|---|
| public static final byte MAX_VALUE A constant holding the maximum value a | |
| MIN_VALUE | back to summary |
|---|---|
| public static final byte MIN_VALUE A constant holding the minimum value a | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. use serialVersionUID from JDK 1.1. for interoperability | |
| SIZE | back to summary |
|---|---|
| public static final int SIZE The number of bits used to represent a
| |
| TYPE | back to summary |
|---|---|
| public static final Class<Byte> TYPE The | |
| value | back to summary |
|---|---|
| private final byte value The value of the | |
| Byte | back to summary |
|---|---|
| public Byte(byte value)
Deprecated since 9. It is rarely appropriate to use this constructor. The static factory
Constructs a newly allocated
| |
| Byte | back to summary |
|---|---|
| public Byte(String s) throws NumberFormatException
Deprecated since 9. It is rarely appropriate to use this constructor.
Use Constructs a newly allocated
| |
| byteValue | back to summary |
|---|---|
| public byte byteValue() Overrides java. Returns the value of this
| |
| compare | back to summary |
|---|---|
| public static int compare(byte x, byte y) Compares two Byte.valueOf(x).compareTo(Byte.valueOf(y))
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(Byte anotherByte) Implements java. Compares two
| |
| compareUnsigned | back to summary |
|---|---|
| public static int compareUnsigned(byte x, byte y) Compares two
| |
| decode | back to summary |
|---|---|
| public static Byte decode(String nm) throws NumberFormatException Decodes a DecimalNumeral, HexDigits, and OctalDigits are as defined in section 3.10.1 of The Java Language Specification, except that underscores are not accepted between digits. The sequence of characters following an optional
sign and/or radix specifier ("
| |
| describeConstable | back to summary |
|---|---|
| public Optional Implements java. Returns an | |
| doubleValue | back to summary |
|---|---|
| public double doubleValue() Implements abstract java. Returns the value of this
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Compares this object to the specified object. The result is
| |
| floatValue | back to summary |
|---|---|
| public float floatValue() Implements abstract java. Returns the value of this
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a hash code for this
| |
| hashCode | back to summary |
|---|---|
| public static int hashCode(byte value) Returns a hash code for a
| |
| intValue | back to summary |
|---|---|
| public int intValue() Implements abstract java. Returns the value of this
| |
| longValue | back to summary |
|---|---|
| public long longValue() Implements abstract java. Returns the value of this
| |
| parseByte | back to summary |
|---|---|
| public static byte parseByte(String s, int radix) throws NumberFormatException Parses the string argument as a signed An exception of type
| |
| parseByte | back to summary |
|---|---|
| public static byte parseByte(String s) throws NumberFormatException Parses the string argument as a signed decimal
| |
| shortValue | back to summary |
|---|---|
| public short shortValue() Overrides java. Returns the value of this
| |
| toString | back to summary |
|---|---|
| public static String toString(byte b) Returns a new
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a | |
| toUnsignedInt | back to summary |
|---|---|
| public static int toUnsignedInt(byte x) Converts the argument to an
| |
| toUnsignedLong | back to summary |
|---|---|
| public static long toUnsignedLong(byte x) Converts the argument to a
| |
| valueOf | back to summary |
|---|---|
| public static Byte valueOf(byte b) Returns a
| |
| valueOf | back to summary |
|---|---|
| public static Byte valueOf(String s, int radix) throws NumberFormatException Returns a In other words, this method returns a
| |
| valueOf | back to summary |
|---|---|
| public static Byte valueOf(String s) throws NumberFormatException Returns a In other words, this method returns a
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static Byte[] | |
| pack-priv static final Byte[] |
| Access | Constructor and Description |
|---|---|
| private |
| archivedCache | back to summary |
|---|---|
| pack-priv static Byte[] archivedCache | |
| cache | back to summary |
|---|---|
| pack-priv static final Byte[] cache
| |
| ByteCache | back to summary |
|---|---|
| private ByteCache() | |