newbie needhing help: string .getbytes returns un-understood bytes! help?
843810May 21 2008 — edited May 25 2008Hello, I've gone nuts searching for a string to byte array function. The getBytes seemed to fill the bill, but I end up with extra bytes in the byte array. Here's the code snippet:
String sx = "012345678901234567890";
byte[] x = new byte[ sx.length()];
try {
x = sx.getBytes("ASCII");
} catch (Exception e) {System.out.println("geBytes error: " + e);}
results when I loop through the array and output as char:
[B@1fb8ee3
012345678901234567890
Could anybody explain to me why and what the "[B@1fb8ee3" really is? Is there another method to getting a byte[] from a string?
Thank you!