[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: converting an array of char[] to array of byte[]?



One easy way is to create a String from the char[] and then use the
getBytes() method, something like the following:

char[] c = some char array
String temp = new String(c);
byte b[] = temp.getBytes();

This approach lets the String class worry about character to byte
conversion.

Steven Caswell
stevencaswell@yahoo.com
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: D. Michael Nelson [mailto:dmn1@bellsouth.net] 
> Sent: Sunday, March 03, 2002 11:48 AM
> To: Ajug
> Subject: converting an array of char[] to array of byte[]?
> Importance: High
> 
> 
> 
> Hello,
> 
> Is there a standard class method for converting an array of 
> char[] to array of byte[], or do I just write my own. Thanks 
> in advance.
> 
> Take It Easy,
> Michael
> 



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com