Byte class is a wrapper class for the primitive type byte which contains several methods to effectively deal with a byte value like converting it to a string representation, and vice-versa. An object of Byte class can hold a single byte value.
Byte class offers four constants in the form of Fields. These are:
-
MAX_VALUE:The MAX_VALUE is a instance variable of Byte class which is used to return the maximum byte value.
Syntax:
public static final byte MAX_VALUE
Usage:
Byte.MAX_VALUE
Return Value: It returns a byte value equal to 127.
Below is the implementation of MAX_VALUE:
// Java code to implement// MAX_VALUE of Byte classclassGFG {publicstaticvoidmain(String[] args){// byte variablebytemax_value;// MAX_VALUE Byte classmax_value = Byte.MAX_VALUE;// printing the MAX_VALUESystem.out.println(max_value);}}chevron_rightfilter_noneOutput:127
- MIN_VALUE:The MIN_VALUE is a instance variable of Byte class which is used to return the minimum byte value.
Syntax:
public static final byte MIN_VALUE
Usage:
Byte.MIN_VALUE
Return Value: It returns a byte value equal to -128.
Below is the implementation of MIN_VALUE:
// Java code to implement// MIN_VALUE of Byte classclassGFG {publicstaticvoidmain(String[] args){// byte variablebytemin_value;// MIN_VALUE Byte classmin_value = Byte.MIN_VALUE;// printing the MIN_VALUESystem.out.println(min_value);}}chevron_rightfilter_noneOutput:
-128
- SIZE:The SIZE is a instance variable of Byte class which is used to return number of bits required to represent a byte value in binary representation (two’s complement).
Syntax:
public static final int SIZE
Usage:
Byte.SIZE
Return Value: It returns a int value equal to 8.
Below is the implementation of SIZE:
// Java code to implement// SIZE of Byte classclassGFG {publicstaticvoidmain(String[] args){// SIZE Byte classintoutput = Byte.SIZE;// printing the outputSystem.out.println(output);}}chevron_rightfilter_noneOutput:8
- TYPE: The TYPE is a instance variable of Byte class which is used to return Class instance representing the primitive data type byte.
Syntax:
public static final Class<Byte> TYPE
Usage:
Byte.TYPE
Return Value: It returns an Class instance representing the primitive data type byte.
Below is the implementation of TYPE:
// Java code to implement// TYPE of Byte classclassGFG {publicstaticvoidmain(String[] args){// TYPE variable of Byte classClass<Byte> output = Byte.TYPE;// printing the outputSystem.out.println(output);}}chevron_rightfilter_noneOutput:byte
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- Java.Lang.Byte class in Java
- Java Guava | Bytes.indexOf(byte[] array, byte[] target) method with Examples
- Java Guava | Bytes.indexOf(byte[] array, byte target) method with Examples
- CharMatcher fields with Examples | Guava | Java
- Implement Ennead Class from Octet Class in Java using JavaTuples
- Implement Octet Class from Septet Class in Java using JavaTuples
- Implement Septet Class from Sextet Class in Java using JavaTuples
- Implement Sextet Class from Quintet Class in Java using JavaTuples
- Implement Quartet Class with Triplet Class in Java using JavaTuples
- Implement Decade Class from Ennead Class in Java using JavaTuples
- Implement Quintet Class with Quartet Class in Java using JavaTuples
- Implement Triplet Class with Pair Class in Java using JavaTuples
- Implement Pair Class with Unit Class in Java using JavaTuples
- Difference between Abstract Class and Concrete Class in Java
- In Java, Can we call the main() method of a class from another class?
- Byte byteValue() method in Java with examples
- Byte toString() method in Java with examples
- Byte doubleValue() method in Java with examples
- Byte longValue() method in Java with examples
- Byte shortValue() method in Java with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

