public static String DecodeASCII(String ascii){
ArrayList<Byte> buffer =new ArrayList<Byte>();
for (int i = 0; i < ascii.length(); i += 2)
{
String temp = ascii.substring(i, 2);
byte value = Convert.ToByte(temp, 16);
buffer.add(value);
}
String str = System.Text.Encoding.ASCII.GetString(buffer.toArray());
}
这是C#的做法转到java里面之后以下两句有错误
byte value = Convert.ToByte(temp, 16); 错误:Convert cannot be resolved
String str = System.Text.Encoding.ASCII.GetString(buffer.toArray());错误:Text cannot be resolved or is not a field
求解决办法
------解决方案--------------------
java和C#可不是直接复制过来就能用的...Convert对象和System.Text都不存在。