Byte

public final class Byte extends Number
implements Comparable<Byte>

The Byte class wraps a value of primitive type byte in an object. 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.

See Also

Constant Summary

int BYTES The number of bytes used to represent a byte value in two's complement binary form.
byte MAX_VALUE A constant holding the maximum value a byte can have, 27-1.
byte MIN_VALUE A constant holding the minimum value a byte can have, -27.
int SIZE The number of bits used to represent a byte value in two's complement binary form.

Field Summary

public static final Class<Byte> TYPE The Class instance representing the primitive type byte.

Public Constructor Summary

Byte(byte value)
Constructs a newly allocated Byte object that represents the specified byte value.
Byte(String s)
Constructs a newly allocated Byte object that represents the byte value indicated by the String parameter.

Public Method Summary

byte
byteValue()
Returns the value of this Byte as a byte.
static int
compare(byte x, byte y)
Compares two byte values numerically.
int
compareTo(Byte anotherByte)
Compares two Byte objects numerically.
static Byte
decode(String nm)
Decodes a String into a Byte.
double
doubleValue()
Returns the value of this Byte as a double.
boolean
equals(Object obj)
Compares this object to the specified object.
float
floatValue()
Returns the value of this Byte as a float.
int
hashCode()
Returns a hash code for this Byte; equal to the result of invoking intValue().
static int
hashCode(byte value)
Returns a hash code for a byte value; compatible with Byte.hashCode().
int
intValue()
Returns the value of this Byte as an int.
long
longValue()
Returns the value of this Byte as a long.
static byte
parseByte(String s)
Parses the string argument as a signed decimal byte.
static byte
parseByte(String s, int radix)
Parses the string argument as a signed byte in the radix specified by the second argument.
short
shortValue()
Returns the value of this Byte as a short.
String
toString()
Returns a String object representing this Byte's value.
static String
toString(byte b)
Returns a new String object representing the specified byte.
static Byte
valueOf(String s)
Returns a Byte object holding the value given by the specified String.
static Byte
valueOf(String s, int radix)
Returns a Byte object holding the value extracted from the specified String when parsed with the radix given by the second argument.
static Byte
valueOf(byte b)
Returns a Byte instance representing the specified byte value.

Inherited Method Summary