aspose file tools
The moose likes Beginning Java and the fly likes convert String Value to Hexa Value ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "convert String Value to Hexa Value ?" Watch "convert String Value to Hexa Value ?" New topic
Author

convert String Value to Hexa Value ?

sachin kataria
Ranch Hand

Joined: Mar 27, 2006
Posts: 43
hi,
i want to convert String value to Hexa Value.
so, how i can do that ??
my String value len is 20.
i.e.
String str = "31080601090620003453";

so, how i convert this value to hexa value..

pls, help me....
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24061
    
  13

I can't tell precisely what you're after, but I suspect that the parseInt() and toHexString() methods in the java.lang.Integer class will do exactly what you need.


[Jess in Action][AskingGoodQuestions]
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
20 places will exceed Long.MAX_VALUE of 9223372036854775807 19 places so, Use BigInteger

The second toString takes the radix of the number base. For hex it's 16.
[ August 31, 2006: Message edited by: Carl Trusiak ]

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert String Value to Hexa Value ?
 
Similar Threads
switch statement problem
convert data in javascript
Wrapper class Long.toString() method
convert String in to String array ???
convert String into Object