Java - 将 int 更改为 ascii

2022-01-14 00:00:00 int java

java有没有办法将int转换为ascii符号?

Is there a way for java to convert int's to ascii symbols?

推荐答案

你想把 ints 转换成 chars 吗?:

Do you want to convert ints to chars?:

int yourInt = 33;
char ch = (char) yourInt;
System.out.println(yourInt);
System.out.println(ch);
// Output:
// 33
// !

还是要将 ints 转换为 Strings?

Or do you want to convert ints to Strings?

int yourInt = 33;
String str = String.valueOf(yourInt);

或者你的意思是什么?

相关文章