http://stackoverflow.com/questions/19388037/converting-characters-to-integers-in-javajava
这个函数能够用于将char的值输出ide
Character.getNumericValue(c)
这个函数能够将值转为字符输出函数
If you simply want to cast the value in the int, you can cast it using Java's typecast notation:idea
int i = 97; // 97 is 'a' in ASCII char c = (char) i; // c is now 'a'
若是你在编译器里面输出结果,你会发现是乱码,缘由是什么呢?参考spa
Most answers here propose shortcuts, which can bring you in big problems if you have no idea what you are doing. If you want to take shortcuts, then you have to know exactly what encoding your data is in.code
Whenever java talks about characters in its documentation, it talks about 16-bit characters.ci
You can use a DataInputStream
, which has convenient methods. For efficiency, wrap it in a BufferedReader
.get
http://stackoverflow.com/questions/833709/converting-stream-of-ints-to-chars-in-java编译器