Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I convert Hex to ASCII in Java?

Status
Not open for further replies.

Zappa

IS-IT--Management
Oct 17, 2001
1
US
Anyone know of a function in java that will convert a hexString to some ASCII representation?
 
Have a look at this it should do what you want. 4D is converted to its ASCII M it is padded out with \00 as it uses Unicode.


Code:
void jButton1_actionPerformed( ActionEvent e )
   {
      String myString = "\004D";
      char myChar = myString.charAt( 0 );
      JOptionPane.showMessageDialog( null,"Conv "+myChar );
   }


Hope this was of help
Billy H

bhogar@acxiom.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top