getBytes()uses the default encoding for the system, which means that basically all bets are disabled. It could be widescreen UTF-16, little-endian UTF-16, UTF-8, ISO-8859-1 ... basically anything.
If you need to specify instantiation or anything about the encoding, you should use getBytes(Charset)or getBytes(String). There are several standard encodings that are supported by all JREs - including UTF_16BE (large end) and UTF_16LE (small end).
source
share