aspose file tools
The moose likes Java in General and the fly likes Ascii to hex converter Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Ascii to hex converter" Watch "Ascii to hex converter" New topic
Author

Ascii to hex converter

Ghaith Shamayleh
Greenhorn

Joined: Apr 13, 2011
Posts: 13
I would like if there is a function in java that can be used to covert a string of ascii to a string of hex, or should i write a method to write this, can anyway help
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
This one does it one character at a time; I'm actually cramming unicode into byte, but if you have ASCII (in 7 or 8 bits), it will cast to byte as well.

Look up details for formatting string output under java.util.Formatter

rc>
Ghaith Shamayleh
Greenhorn

Joined: Apr 13, 2011
Posts: 13
this will take a string of hex and convert it or a string of ascii and covert it
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
What is a String of hex? Do you mean a String which only contains the characters 0-9 a-f and A-F? Your last comment appears to want the opposite of what the thread title says you want.
Ghaith Shamayleh
Greenhorn

Joined: Apr 13, 2011
Posts: 13
i got it cheers everyone
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
Well done
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Ascii to hex converter
 
Similar Threads
Writting to the DB File - totally lost
character coding problem
Trouble with system.in manipulation
Adding Hexadecimal to byte array
URlyBird: Data File Corrupted???