how to convert a char from alphabetical character to hexadecimal number in java a if any one have any built-in method in java that does the job or if you have your own metho
Use the apache commons codec library
Specifically: http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Hex.html
You could use:
Integer.toHexString((int) 'a');
Integer.toBinaryString((int) 'b');
Update: hex -> binary conversion:
Integer.toBinaryString(Integer.parseInt("fa", 16))
You can convert from char to hex string.
char ch =
String hex = String.format("%04x", (int) ch);
To read hex and convert to binary you can do
int num = Integer.parseInt(text, 16);
String bin = Integer.toString(num, 2);