• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

String to Byte Array

 
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI

Am new to java.. I need to convert a string to a byte. For implementing some business logics.

My expected output is exactly as this method returns. But its only working for Hex String. I want a piece of code to work with all string

I mean other ABCDEF





Both the above methods were doing the same thing..But only for Hex string. I was to work for Other than HEX string also..
Please assist me
[ December 22, 2008: Message edited by: Meet Gaurav ]
 
Marshal
Posts: 64623
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about serialising to a ByteArrayOutputStream?
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any samples are welcome !!!
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"string".getBytes()
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Freddy..

the getbytes() method is giving some different Output. At the receiving side..I need some sample code. Which I posted earlier..But that is working fine for HEX string
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!