Go Back   Java Programming Forums > Java Standard Edition Programming Help > Java Theory & Questions


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-04-2009, 03:44 AM
Junior Member
 

Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
nathanernest is on a distinguished road
Default Converting Hexadecimal to Char

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!!!



Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
  #2 (permalink)  
Old 08-04-2009, 07:11 AM
JavaPF's Avatar
mmm.. coffee
 
8 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,543
Thanks: 98
Thanked 92 Times in 85 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Relaxed
Default Re: Converting Hexadecimal to Char

Hello nathanernest and welcome to the Java Programming Forums

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.
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight]

Forum Tip: Add to peoples reputation () by clicking the button on their useful posts.
Reply With Quote
  #3 (permalink)  
Old 08-04-2009, 08:12 AM
JavaPF's Avatar
mmm.. coffee
 
8 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,543
Thanks: 98
Thanked 92 Times in 85 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Relaxed
Default Re: Converting Hexadecimal to Char

Here is an example:

Java Code
String fileContents = 004e

if(fileContents.equals("004e")){
System.out.println("E")
}
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight]

Forum Tip: Add to peoples reputation () by clicking the button on their useful posts.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hexadecimal BUGG.....er Eric Java Theory & Questions 1 22-06-2009 04:36 PM
[SOLVED] Converting to and comparing integers. luke What's Wrong With My Code? 9 18-05-2009 11:26 PM
Converting GSM 6.10 Wav file to other formats expertise Mobile Applications 3 11-05-2009 11:24 AM
converting to .exe haygaurav Java IDEs 4 01-05-2009 08:32 PM
code help 2 programs. MinMax Values & Converting Temps. awake77 What's Wrong With My Code? 6 20-12-2008 09:12 PM


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 02:03 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.