This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
abalfazl hossein wrote:May someone answer my last question?
I already have: DON'T use ints.
Then What I must use?char?
You have to understand that there are two issues being addressed here. The first is that the UTF-8 getBytes() method is returning 6 bytes, even though you have only 3 characters. You need to find a work around for that.
Second, which this track is trying to address, is that the print out is sign-extending the output (of bytes which are negative). Well, IMO, this second track may be moot, depending on you fix the first issue.
Joined: Oct 13, 2005
abalfazl hossein wrote: . . . UTF-8 consumes two bytes for all non-Latin (Greek, Cyrillic, Arabic, etc.)