在sun.io的包java中 有下面两个函数转化函数。
public static ByteToCharConverter getDefault();
public static ByteToCharConverter getConverter(String encoding);
比如
byte bt[] = {(byte)'\u00c4',(byte)'\u00e3'};
ByteToCharConverter converter = ByteToCharConverter.getConverter();
char ch[] = converter.convertAll(bt);
for (int i = 0; i < ch.length; i++) {
System.out.println(Integer.toHexString(ch[i]));
}
public static ByteToCharConverter getDefault();
public static ByteToCharConverter getConverter(String encoding);
比如
byte bt[] = {(byte)'\u00c4',(byte)'\u00e3'};
ByteToCharConverter converter = ByteToCharConverter.getConverter();
char ch[] = converter.convertAll(bt);
for (int i = 0; i < ch.length; i++) {
System.out.println(Integer.toHexString(ch[i]));
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货