Byte

Name

Byte

Synopsis

Description

The Byte class provides an object wrapper for a byte value. This is useful when you need to treat a byte value as an object. For example, there are a number of utility methods that take a reference to an Object as one of their arguments. You cannot specify a byte value for one of these arguments, but you can provide a reference to a Byte object that encapsulates the byte value. Furthermore, the Byte class is necessary as of JDK 1.1 to support the Reflection API and class literals.

The Byte class also provides a number of utility methods for converting byte values to other primitive types and for converting byte values to strings and vice versa.

Class Summary

public final class java.lang.Byte extends java.lang.Number {
 // Constants public static final byte MAX_VALUE;
public static final byte MIN_VALUE;
public static final Class TYPE; // Constructors public Byte(byte value);
public Byte(String s); // Class Methods public static Byte decode(String nm);
public static byte parseByte(String s);
public static byte parseByte(String s, int radix);
public static String toString(byte b);
public static Byte valueOf(String s, int radix);
public static Byte valueOf(String s); // Instance Methods public byte byteValue();
public double doubleValue;
public boolean equals(Object obj);
public float floatValue public int hashCode();
public int intValue();
public long longValue();
public short shortValue();
public String toString();
}

Constants

MAX_VALUE

public static final byte MAX_VALUE= 127

The largest value that can be represented by a byte.

MIN_VALUE

public static final byte MIN_VALUE= -128

The smallest value that can be represented by a byte.

TYPE

public static final Class TYPE

The Class object that represents the primitive type byte. It is always true that Byte.TYPE == byte.class.

Constructors

Byte

public Byte(byte value)

public Byte(String s) throws NumberFormatException

Class Methods

decode

public static Byte decode(String nm) throws NumberFormatException

parseByte

public static byte parseByte(String s) throws NumberFormatException

public static byte parseByte(String s, int radix) throws NumberFormatException 

toString

public String toString(byte b)

valueOf

public static Byte valueOf(String s) throws NumberFormatException

public static Byte valueOf(String s, int radix) throws NumberFormatException 

Instance Methods

byteValue

public byte byteValue()

doubleValue

public double doubleValue()

equals

public boolean equals(Object obj)

floatValue

public float floatValue()

hashCode

public int hashCode()

intValue

public int intValue()

longValue

public long longValue()

shortValue

public short shortValue()

toString

public String toString()

Inherited Methods

Method Inherited From Method Inherited From
clone() Object finalize() Object
getClass() Object notify() Object
notifyAll() Object wait() Object
wait(long) Object wait(long, int) Object

See Also

Character; Class; Double; Exceptions; Float; Integer literals; Integer types; Integer; Long; Number; Short; String