public final class

Byte

extends Object
java.lang.Object
   ↳ java.lang.Byte

Class Overview

The Byte class is the standard wrapper for byte values.

Summary

Constants
byte MAX_VALUE The maximum value a Byte can have.
byte MIN_VALUE The minimum value a Byte can have.
Public Constructors
Byte(byte value)
Constructs a Byte object initialized to the specified byte value.
Public Methods
byte byteValue()
Returns the value of this Byte as a byte.
boolean equals(Object obj)
Compares this object to the specified object.
int hashCode()
Returns a hashcode for this Byte.
static byte parseByte(String s)
Assuming the specified String represents a byte, returns that byte's value.
static byte parseByte(String s, int radix)
Assuming the specified String represents a byte, returns that byte's value.
String toString()
Returns a String object representing this Byte's value.
static Byte valueOf(byte b)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final byte MAX_VALUE

The maximum value a Byte can have.

Constant Value: 127 (0x0000007f)

public static final byte MIN_VALUE

The minimum value a Byte can have.

Constant Value: -128 (0xffffff80)

Public Constructors

public Byte (byte value)

Constructs a Byte object initialized to the specified byte value.

Parameters
value the initial value of the Byte

Public Methods

public byte byteValue ()

Returns the value of this Byte as a byte.

Returns
  • the value of this Byte as a byte.

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.

public int hashCode ()

Returns a hashcode for this Byte.

Returns
  • a hash code value for this object.

public static byte parseByte (String s)

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
Returns
  • the parsed value of the byte
Throws
NumberFormatException If the string does not contain a parsable byte.

public static byte parseByte (String s, int radix)

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
Returns
  • the parsed value of the byte
Throws
NumberFormatException If the String does not contain a parsable byte.

public String toString ()

Returns a String object representing this Byte's value.

Returns
  • a string representation of the object.

public static Byte valueOf (byte b)