我有字符串 String hex = "6174656ec3a7c3a36f";
,我想得到String output = "atenção"
但在我的测试中我只 String output = "aten????o";
知道我做错了什么?
String hex = "6174656ec3a7c3a36f";
StringBuilder output = new StringBuilder();
for (int i = 0; i < hex.length(); i+=2) {
String str = hex.substring(i, i+2);
output.append((char)Integer.parseInt(str, 16));
}
System.out.println(output); //here is the output "aten????o"