Q:

Right to Left Languages in Java

When I entered 
new String("<some arabic text>".getBytes(), "UTF-8");

despite displayed exactly the way it was pasted (into the eclipse editor), index 0 contained the rightmost character of the string. 
(Also, each arabic letter was two bytes, the first byte being -40 for each. Does that indicate the sequence?)
I would like to know if the java compiler recognizes arabic in the background of if the eclipse editor would reorganize arabic literals? Or why the debugger knew this was arabic, which means the first to be read letter is the rightmost one and as such assigned an index 0.

A:

All text is stored in writing order, so the first (right most) letter in Arabic should be stored in index 0. It's up to the software that displays strings to recognize that the text is Arabic and lay it out right-to-left.
Also, the line of code you quote at best does nothing, at worst it corrupts the data. It encodes the given Unicode string as bytes using the system default encoding, which could be anything, and then pretends the resulting bytes represent some  text in UTF-8 and decodes it.

