public int encodeToCharset(char[] in, int off, int len, byte[] out){ for (int i = off; i< off+len; i++) out[i] = charToByte[in[i]]; return len; }
public byte[] encodeToCharset(String str){ if (bufferB.length < str.length()) bufferB = new byte[str.length()]; int length = encodeToCharset(str.toCharArray(), 0, str.length(), bufferB); byte[] result = new byte[length]; System.arraycopy(bufferB, 0, result, 0, length); return result; }
        public int encodeToCharset(char[] in, int off, int len, byte[] out){            for (int i = off; i< off+len; i++)               out[i] = charToByte[in[i]];            return len;        }