Java.lang.Byte Class
Introduction
The java.lang.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.
Class declaration
Following is the declaration for java.lang.Byte class:
public final class Byte
extends Number
implements Comparable<Byte>
Field
Following are the fields for java.lang.Byte class:
static byte MAX_VALUE -- This is constant holding the maximum value a byte can have, 27-1.
static byte MIN_VALUE -- This is constant holding the minimum value a byte can have, -27.
static int SIZE -- This is the number of bits used to represent a byte value in two's complement binary form.
static Class<Byte> TYPE -- This is the Class instance representing the primitive type byte.
Class constructors
| S.N. | Constructor & Description |
|---|---|
| 1 | Byte(byte value) This constructs a newly allocated Byte object that represents the specified byte value. |
| 2 | Byte(String s) This constructs a newly allocated Byte object that represents the byte value indicated by the String parameter. |
Class methods
| S.N. | Method & Description |
|---|---|
| 1 | byte byteValue() This method returns the value of this Byte as a byte. |
| 2 | int compareTo(Byte anotherByte) This method compares two Byte objects numerically. |
| 3 | static Byte decode(String nm) This method decodes a String into a Byte. |
| 4 | double doubleValue() This method returns the value of this Byte as a double. |
| 5 | boolean equals(Object obj) This method compares this object to the specified object. |
| 6 | float floatValue() This method returns the value of this Byte as a float. |
| 7 | int hashCode() This method returns a hash code for this Byte. |
| 8 | int intValue() This method returns the value of this Byte as an int. |
| 9 | long longValue() This method returns the value of this Byte as a long. |
| 10 | static byte parseByte(String s) This method parses the string argument as a signed decimal byte. |
| 11 | static byte parseByte(String s, int radix) This method parses the string argument as a signed byte in the radix specified by the second argument. |
| 12 | short shortValue() This method returns the value of this Byte as a short. |
| 13 | String toString() This method returns a String object representing this Byte's value. |
| 14 | static String toString(byte b) This method returns a new String object representing the specified byte. |
| 15 | static Byte valueOf(byte b) This method returns a Byte instance representing the specified byte value. |
| 16 | static Byte valueOf(String s) This method returns a Byte object holding the value given by the specified String. |
| 17 | static Byte valueOf(String s, int radix) This method returns a Byte object holding the value extracted from the specified String when parsed with the radix given by the second argument. |
Methods inherited
This class inherits methods from the following classes:
java.lang.Object