public static String fromUTF8ByteArray(byte[] bytes) { char[] chars = new char[bytes.length]; int len = UTF8.transcodeToUTF16(bytes, chars); if (len < 0) { throw new IllegalArgumentException("Invalid UTF-8 input"); } return new String(chars, 0, len); }