• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hexadecimal to String and vis versa  RSS feed

 
Ayman Nour
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
Some data is stored in the database in hexadecimal format. how i can i convert it hexadecimal to normal string and vis versa??
please help.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Integer.parseInt(hexString, 16)
Integer.valueOf(hexString, 16)
Integer.toString(number, 16)
Integer.toHexString(number)
There are Long versions of the same, should you wish.
- Peter
 
Ayman Nour
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tank you peter.
I will try them.
how do i get a list of radix's?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The radix of binary numbers is 2, of octal numbers 8, of decimal numbers 10, and of hexadecimal numbers 16 -- but you can use any radix you want. I think it goes a bit pear-shaped beyond radix 36, though, because you run out of letters to represent your digits
- Peter
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!