    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class java.lang.Byte

    java.lang.Object
       |
       +----java.lang.Number
               |
               +----java.lang.Byte

public final class Byte
extends Number

The Byte class is the standard wrapper for byte values.

See Also:
  Number

##

MAX_VALUE
  The maximum value a Byte can have.
MIN_VALUE
  The minimum value a Byte can have.
TYPE
  The Class object representing the primitive type byte.

##

Byte(byte)
  Constructs a Byte object initialized to the specified byte value.
Byte(String)
  Constructs a Byte object initialized to the value specified by the String parameter.

##

byteValue()
  Returns the value of this Byte as a byte.
decode(String)
  Decodes a String into a Byte.
doubleValue()
  Returns the value of this Byte as a double.
equals(Object)
  Compares this object to the specified object.
floatValue()
  Returns the value of this Byte as a float.
hashCode()
  Returns a hashcode for this Byte.
intValue()
  Returns the value of this Byte as an int.
longValue()
  Returns the value of this Byte as a long.
parseByte(String)
  Assuming the specified String represents a byte, returns that byte's value.
parseByte(String, int)
  Assuming the specified String represents a byte, returns that byte's value.
shortValue()
  Returns the value of this Byte as a short.
toString()
  Returns a String object representing this Byte's value.
toString(byte)
  Returns a new String object representing the specified Byte.
valueOf(String)
  Assuming the specified String represents a byte, returns a new Byte object initialized to that value.
valueOf(String, int)
  Assuming the specified String represents a byte, returns a new Byte object initialized to that value.

##

MIN_VALUE

     public static final byte MIN_VALUE

  The minimum value a Byte can have.

MAX_VALUE

     public static final byte MAX_VALUE

  The maximum value a Byte can have.

TYPE

     public static final Class TYPE

  The Class object representing the primitive type byte.

##

Byte

     public Byte(byte value)

  Constructs a Byte object initialized to the specified byte value.

  Parameters:
    value - the initial value of the Byte

Byte

     public Byte(String s) throws NumberFormatException

  Constructs a Byte object initialized to the value specified by the String parameter. The radix is assumed to be 10.

  Parameters:
    s - the String to be converted to a Byte
  Throws: NumberFormatException
    If the String does not contain a parsable byte.

##

toString

     public static String toString(byte b)

  Returns a new String object representing the specified Byte. The radix is assumed to be 10.

  Parameters:
    b - the byte to be converted

parseByte

     public static byte parseByte(String s) throws NumberFormatException

  Assuming the specified String represents a byte, returns that byte's value. Throws an exception if the String cannot be parsed as a byte. The radix is assumed to be 10.

  Parameters:
    s - the String containing the byte
  Throws: NumberFormatException
    If the string does not contain a parsable byte.

parseByte

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

  Assuming the specified String represents a byte, returns that byte's value. Throws an exception if the String cannot be parsed as a byte.

  Parameters:
    s - the String containing the byte
    radix - the radix to be used
  Throws: NumberFormatException
    If the String does not contain a parsable byte.

valueOf

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

  Assuming the specified String represents a byte, returns a new Byte object initialized to that value. Throws an exception if the String cannot be parsed as a byte.

  Parameters:
    s - the String containing the integer
    radix - the radix to be used
  Throws: NumberFormatException
    If the String does not contain a parsable byte.

valueOf

     public static Byte valueOf(String s) throws NumberFormatException

  Assuming the specified String represents a byte, returns a new Byte object initialized to that value. Throws an exception if the String cannot be parsed as a byte. The radix is assumed to be 10.

  Parameters:
    s - the String containing the integer
  Throws: NumberFormatException
    If the String does not contain a parsable byte.

decode

     public static Byte decode(String nm) throws NumberFormatException

  Decodes a String into a Byte. The String may represent decimal, hexadecimal, and octal numbers.

  Parameters:
    nm - the string to decode

byteValue

     public byte byteValue()

  Returns the value of this Byte as a byte.

  Overrides:
    byteValue in class Number

shortValue

     public short shortValue()

  Returns the value of this Byte as a short.

  Overrides:
    shortValue in class Number

intValue

     public int intValue()

  Returns the value of this Byte as an int.

  Overrides:
    intValue in class Number

longValue

     public long longValue()

  Returns the value of this Byte as a long.

  Overrides:
    longValue in class Number

floatValue

     public float floatValue()

  Returns the value of this Byte as a float.

  Overrides:
    floatValue in class Number

doubleValue

     public double doubleValue()

  Returns the value of this Byte as a double.

  Overrides:
    doubleValue in class Number

toString

     public String toString()

  Returns a String object representing this Byte's value.

  Overrides:
    toString in class Object

hashCode

     public int hashCode()

  Returns a hashcode for this Byte.

  Overrides:
    hashCode in class Object

equals

     public boolean equals(Object obj)

  Compares this object to the specified object.

  Parameters:
    obj - the object to compare with
  Returns:
    true if the objects are the same; false otherwise.
  Overrides:
    equals in class Object

    All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.