I need to get bytes of millions of string using this :
String str="blablabla...."; // some UTF-16LE encoding string extracted from DB
bytes=str.getBytes("UTF-16LE")
But this is awfully slow. There are custom fast versions of getBytes but they don't support UTF-16LE. For example this is one of them:
// http://stackoverflow.com/questions/12239993/why-is-the-native-string-getbytes-method-slower-than-the-custom-implemented-getb
private static byte[] getBytesFast(String str) {
    final char buffer[] = new char[str.length()];
    final int length = str.length();
    str.getChars(0, length, buffer, 0);
    final byte b[] = new byte[length];
    for (int j = 0; j < length; j++)
        b[j] = (byte) buffer[j];
    return b;
}
Is there similar fast solution to convert the Java string into byte array using UTF-16LE encoding?
 
    