aspose file tools
The moose likes Beginning Java and the fly likes Writing Hex Values to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Writing Hex Values to a file" Watch "Writing Hex Values to a file" New topic
Author

Writing Hex Values to a file

Nikhil Bansal
Ranch Hand

Joined: Jan 24, 2005
Posts: 60
Hi All,

I do have certain Hex values (For example A-41,B-42,C-43 etc).I want to write the hex values to a file through my java program and the file should contain A,B,C.

Any clues....

Thx in advance

Nikhil


ban$al
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32644
    
    4
If you use a Formatter object to write the values, you can change the numbers to characters using a %c tag in the format() method. I think it only works in a text file; Formatter is the opposite of Scanner, so it is a basic and simple text writing device. But it works and is easy to use.

BTW. You don't have hex values. You have a number 00....00 0100 0001, for example, which might represent 41 in hex, or 65 in decimal, or 101 in octal, or 'A' as a char. Or even 00....00 0100 0001 in any of the Java integer number primitive formats. You char type is only a number which is displayed as a character. So you can display the same number in all sorts of different format.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Writing Hex Values to a file
 
Similar Threads
Need help to output unsigned byte > 127
Convert Color (RGB) to Hex
Right shift using array
Ascii to Hex
Conversion ?