Alan;

This is a good one, and I really need to look into the API doc. Here is
another question: how to convert a byte array back into a string (smarter
than ... you know what I mean).



Jeff

-----Original Message-----
From: Alan Williamson [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 27, 2002 1:17 PM
To: JDJList
Subject: [jdjlist] RE: convert a string into a byte array


|||     for (int i = 0; i < len; i++)
|||             myBytes[i] = (byte) myString.charAt(i);
||| 
||| Do you have a smarter way of doing this?

Well i really hate to say it ... *BUT* had you read the API docs you would
have found:

-------------------------------------------
java.lang.String

public byte[] getBytes()

        Convert this String into bytes according to the 
        platform's default character encoding, storing 
        the result into a new byte array.

Returns:
        the resultant byte array.
Since: 
        JDK1.1 
-------------------------------------------

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Save Bandwidth! Clean up your posts before replying
____________________________________________________

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Save Bandwidth! Clean up your posts before replying
____________________________________________________

Reply via email to