• Post Reply Bookmark Topic Watch Topic
  • New Topic

String to Byte Array  RSS feed

 
Meet Gaurav
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 ]
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • 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 !!!
 
Freddy Wong
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!