code: public static int encodeUtf8(byte[] array, int pos, String string) {
  		int p = pos;
  		for (int i = 0; i < string.length(); i++) {
  			p += encodeUtf8(array, p, string.charAt(i));
  		}
  		return p - pos;
  	}
docs: UTF-8