Java source code examples

Java source code samples. Java code examples.

Convert a hexadecimal String object to Byte.

          0 votes

The valueOf method of Byte class is used for converting a hexadecimal String to Byte object.

public class ByteWrapper {
	public static void main(String[] args) {
		String str = "f";
		Byte objByte = Byte.parseByte(str, 16);
		System.out.println(objByte);
	}
}

Tags: java.lang

Discuss This Code