String s = "ABCÃࠁ";
byte[] bytes = s.getBytes();
char[] charArray = s.toCharArray();
The above in debug with the default Charset of UTF-8
In the above, the last character in the string, which is the last element in the charArray
, is "represented" by 3 bytes. Can we still say a "char
" is 2 bytes? Since an array
is a contiguous sequence of bytes in memory with equal number of bytes for each element, how many bytes-long might be each element of the charArray
?