Intel

Developer Zone

Byte

java.lang

Class Byte



  • public class Byte
    extends Object
    • Field Summary

      Fields
      Modifier and Type Field and Description
      static byte MAX_VALUE
      Constant for the maximum Byte value, 27-1
      static byte MIN_VALUE
      Constant for the minimum Byte value, -27.
    • Constructor Summary

      Constructors
      Constructor and Description
      Byte(byte value)
      Constructs a new Byte with the specified primitive byte value.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      byte byteValue()
      Gets the primitive value of this byte.
      boolean equals(Object object)
      Compares this object with the specified object and indicates if they are equal.
      int hashCode()
      Returns an integer hash code for this byte.
      static byte parseByte(String string)
      Parses the specified string as a signed decimal byte value.
      static byte parseByte(String string, int radix)
      Parses the specified string as a signed byte value using the specified radix.
      String toString()
      Converts this byte into its decimal string representation.
      static Byte valueOf(byte b)
      Returns a Byte instance for the specified byte value.
    • Field Detail

      • MAX_VALUE

        public static final byte MAX_VALUE
        Constant for the maximum Byte value, 27-1
        See Also:
        Constant Field Values
      • MIN_VALUE

        public static final byte MIN_VALUE
        Constant for the minimum Byte value, -27.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Byte

        public Byte(byte value)
        Constructs a new Byte with the specified primitive byte value.
        Parameters:
        value - the primitive byte value to store in the new instance.
    • Method Detail

      • toString

        public String toString()
        Converts this byte into its decimal string representation. The returned string is a concatenation of a minus sign if the number is negative and characters from '0' to '9'.
        Overrides:
        toString in class Object
        Returns:
        the decimal string representation of value.
      • byteValue

        public byte byteValue()
        Gets the primitive value of this byte.
        Returns:
        this object's primitive value.
      • equals

        public boolean equals(Object object)
        Compares this object with the specified object and indicates if they are equal. In order to be equal, object must be an instance of Byte and have the same byte value as this object.
        Overrides:
        equals in class Object
        Parameters:
        object - the object to compare this byte with.
        Returns:
        true if the specified object is equal to this Byte; false otherwise.
        See Also:
        Object.hashCode()
      • parseByte

        public static byte parseByte(String string)
                              throws NumberFormatException
        Parses the specified string as a signed decimal byte value. The ASCII character - ('-') is recognized as the minus sign.
        Parameters:
        string - the string representation of a single byte value.
        Returns:
        the primitive byte value represented by string.
        Throws:
        NumberFormatException - if string is null, has a length of zero or can not be parsed as a byte value.
      • parseByte

        public static byte parseByte(String string,
                     int radix)
                              throws NumberFormatException
        Parses the specified string as a signed byte value using the specified radix. The ASCII character - ('-') is recognized as the minus sign.
        Parameters:
        string - the string representation of a single byte value.
        radix - the radix to use when parsing.
        Returns:
        the primitive byte value represented by string using radix.
        Throws:
        NumberFormatException - if string is null or has a length of zero, radix < Character.MIN_RADIX, radix > Character.MAX_RADIX, or if string can not be parsed as a byte value.
      • valueOf

        public static Byte valueOf(byte b)
        Returns a Byte instance for the specified byte value.

        If it is not necessary to get a new Byte instance, it is recommended to use this method instead of the constructor, since it maintains a cache of instances which may result in better performance.

        Parameters:
        b - the byte value to store in the instance.
        Returns:
        a Byte instance containing b.
        Since:
        1.5