
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert Hexadecimal Value to Byte in Java
A Byte class is a subclass of Number class and it can wrap a value of primitive type byte in an object. An object of type Byte contains a single field whose type is a byte. The important methods of Byte class are byteValue(), compare(), compareTo(), decode(), parseByte(), valueOf() and etc. We can convert a hexadecimal value to a byte using the method decode().byteValue() of Byte class.
Syntax
public final class Byte extends Number implements Comparable<Byte>
Example
public class ConvertHexaDecimalToByte { public static void main(String args[]) { byte b = Byte.decode("0x0a").byteValue(); // convert hexadecimal value to byte. System.out.println(b); } }
Output
10
Advertisements