• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to convert a string to hexadecimal

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
Is there a way to convert a string to hexadecimal?
Ex, I want to convert the string "java" to hex value. How do I do that?
I searched around but no luck. Before there was a method toHexString from String class, but the method is removed.
Thanks!
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by June Quin:
Before there was a method toHexString from String class, but the method is removed.


I don't remember there ever being a toHexString() in java.lang.String. There is a method with that name in java.lang.Integer. You could use getBytes() on the String and iterate through them, calling Integer.toHexString() on the individual bytes.
 
reply
    Bookmark Topic Watch Topic
  • New Topic