Program to convert Hexadecimal to its Character equivalent
Hey all!
I have a problem lol.
I am trying to convert a hexadecimal value to its character equivilent.
The specific task is a school assignment and I am very open about this. I need to import a file which contains the contents of the said hexadecimal values, read the file and display the characters on the screen.
I have EVERYTHING done except fot the actual conversion lol. I have the import, printing even the loops to read the file from start to finish. All I need now is to know how to actually do the conversion lol. Is there an easy way to do this?
So my simple question is this.
String fileContents = 004e
//convert the file contents here
Println(character)
finished.
How can this be done?
\
Thanks all!!!
Re: Converting Hexadecimal to Char
Hello nathanernest and welcome to the Java Programming Forums :D
To convert the fileContents String to its corresponding character value, you will probably need a load of 'if' statements.
Can you please post the code you have so far, including the file it reads and I will take a look.
Re: Converting Hexadecimal to Char
Here is an example:
Code :
String fileContents = 004e
if(fileContents.equals("004e")){
System.out.println("E")
}