62,614
社区成员
发帖
与我相关
我的任务
分享
class C {
public static char byteToChar(byte[] b) {
int s = 0;
if (b[0] > 0)
s += b[0];
else
s += 256 + b[0];
s *= 256;
if (b[1] > 0)
s += b[1];
else
s += 256 + b[1];
char ch = (char) s;
return ch;
}
public static void main(String[] args) {
System.out.println("请输入运算符 <+ - * />");
Scanner input = new Scanner(System.in);
System.out.println(input.nextLine());
char a = byteToChar(input.nextLine().getBytes());
System.out.println(a);
}
}