I am wondering about java String and byte representation of it. I have a file encoded in UTF-16 little endian, when I view it in my hexeditor I can see
ff fe 61 00 f3 00 61 00 00
now, when I load it to Java using
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName),"UTF-16"));
StringBuilder builder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null)
builder.append(line);
System.out.println(Arrays.toString(builder.toString().getBytes()));
I can see in output
[97, -13, 97]
if I am printing bytes why can't I see the zero ones that I can see in my hexeditor?
builder.toString().getBytes("UTF-16LE")?