A Byte class is a subclass of the Number class, which can wrap the value of the original type byte in an object. An object of class Byte contains a single field of type byte. Important methods of the Byte class include byteValue(), compare(), compareTo(), decode(), parseByte (), valueOf(), etc. We can use the Byte class method decode().byteValue() to convert the hexadecimal value to byte. The Chinese translation of
<strong>public final class Byte extends Number implements Comparable<Byte></strong>
public class ConvertHexaDecimalToByte { public static void main(String args[]) { byte b = Byte.decode("0x0a").byteValue(); <strong>// convert hexadecimal value to byte.</strong> System.out.println(b); } }
10
The above is the detailed content of How do we convert hexadecimal value to bytes in Java?. For more information, please follow other related articles on the PHP Chinese website!