Module java.base
Package java.lang

# Class Byte

≠
public final class Byte
extends java.lang.Number
implements java.lang.Comparable<java.lang.Byte>, java.lang.constant.Constable
Comparing jdk-master and valhalla-csr-open

All Implemented Interfaces:
  `Serializable, Comparable<Byte>, Constable`

public final class Byte extends Number implements Comparable<Byte>, Constable
The `Byte` class is the wrapper class for values of the primitive type `byte` . An object of type `Byte` contains a single field whose type is `byte` .

In addition, this class provides several methods for converting a `byte` to a `String` and a `String` to a `byte` , as well as other constants and methods useful when dealing with a `byte` .

This is a value-based class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail mutexes, or with object references.

When preview features are enabled, `Byte` is a value classPREVIEW . Use of value class instances for synchronization, mutexes, or with object references result in `IdentityException` PREVIEW Moved out of a paragraph.Moved to a division with class preview-block.Moved to a division with class preview-comment..

Since:
  1.1
See Also:
  - `Number`
  - Serialized Form

## Fields

- =
  public static final int BYTES = 1
- =
  public static final byte MAX_VALUE = 127
- =
  public static final byte MIN_VALUE = -128
- =
  public static final int SIZE = 8
- =
  public static final java.lang.Class<java.lang.Byte> TYPE

## Constructors

- =
  @Deprecated(since="9")
  public Byte(byte arg0)
- =
  @Deprecated(since="9")
  public Byte(java.lang.String arg0) throws java.lang.NumberFormatException

## Methods

- =
  public byte byteValue()
- =
  public static int compare(byte arg0, byte arg1)
- =
  public int compareTo(java.lang.Byte arg0)
- =
  public static int compareUnsigned(byte arg0, byte arg1)
- =
  public static java.lang.Byte decode(java.lang.String arg0) throws java.lang.NumberFormatException
- =
  public java.util.Optional<java.lang.constant.DynamicConstantDesc<java.lang.Byte>> describeConstable()
- =
  public double doubleValue()
- =
  public boolean equals(java.lang.Object arg0)
- =
  public float floatValue()
- =
  public int hashCode()
- =
  public static int hashCode(byte arg0)
- =
  public int intValue()
- =
  public long longValue()
- =
  public static byte parseByte(java.lang.String arg0) throws java.lang.NumberFormatException
- =
  public static byte parseByte(java.lang.String arg0, int arg1) throws java.lang.NumberFormatException
- =
  public short shortValue()
- =
  public java.lang.String toString()
- =
  public static java.lang.String toString(byte arg0)
- =
  public static int toUnsignedInt(byte arg0)
- =
  public static long toUnsignedLong(byte arg0)
- ≠
  public static java.lang.Byte valueOf(byte arg0)
  Comparing jdk-master and valhalla-csr-open

  ### valueOf

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

  - When preview features are NOT enabled, `Byte` is an identity class. Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph.If a new `Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph.Byte` Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph. instance is not required, this method should generally be used in preference to the constructor `Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph.Byte(byte)` Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph., as this method is likely to yield significantly better space and time performance since all byte values are cached.

  - When preview features are enabled, `Byte` is a value classPREVIEW . The `valueOf` behavior is the same as invoking the constructor, whether cached or not.

  Parameters:
    `b` - a byte value.
  Returns:
    a `Byte` instance representing `b` .
  Since:
    1.5
- =
  public static java.lang.Byte valueOf(java.lang.String arg0) throws java.lang.NumberFormatException
- =
  public static java.lang.Byte valueOf(java.lang.String arg0, int arg1) throws java.lang.NumberFormatException

## Serialized Form

=

### serialVersionUID

=-7183698231559129828

### Serialized Fields

- =
  byte value

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
Byte |  |  |  |  |  |  | 7 | 2 |  | 9
valueOf(byte) |  |  |  |  |  |  | 6 | 3 |  | 9
Total |  |  |  |  |  |  | 13 | 5 |  | 18