JAVA ASCII码 读入字符串测试
来源:互联网 发布:淘宝开店需要保证金吗 编辑:程序博客网 时间:2024/06/07 11:09
JAVA ASCII码 读入字符串测试
public class RhzfYunTest {
public static void main(String[] args) {
int lenSize =6;
byte[] line = (byte[])null;
byte[] lenBuffer = new byte[lenSize];
String readLine = null;
int messageLength;
// lenBuffer[0] = (byte)63;// ? ascii 是63 48 对应 0 57 对应 9
lenBuffer[0] = (byte)63;// ? ascii 是63 48 对应 0 57 对应 9
lenBuffer[1] = (byte)63;
lenBuffer[2] = (byte)63;
lenBuffer[3] = (byte)32;// 32 对应空字符
lenBuffer[4] = (byte)32;
lenBuffer[5] = (byte)32;
System.out.println ("Service socketReceiveMsgServe() received messageLength is " + new String(lenBuffer));
messageLength = Integer.valueOf((new String(lenBuffer)).trim()).intValue();
System.out.println ("messageLength : "+ messageLength);
}
}
运行结果
Service socketReceiveMsgServe() received messageLength is ???
Exception in thread "main" java.lang.NumberFormatException: For input string: "???"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.valueOf(Integer.java:766)
at com.idea.rhzf.RhzfYunTest.main(RhzfYunTest.java:25)
- JAVA ASCII码 读入字符串测试
- java读入输出文件字符串
- [Java]字符串 与 ASCII码 相互转换
- 测试ASCII码方法
- 读入字符串
- ASCII码转字符串
- Java字符串跟ASCII码互转
- Java字符串转换为ASCII
- java ASCII码转BCD码 BCD码转字符串
- java ASCII码转BCD码 BCD码转字符串
- Java中文字符串(String)和ASCII码互相转换
- java之查看字符、字符串的ASCII码
- 字符串转Ascii码与Ascii码转字符串
- 字符串转换成ASCII码
- 将字符串转成ASCII码
- 字符串和AscII码转换
- ASCII码与字符串转换
- 字符串与ASCII码互换
- 动态库的编写和使用
- POJ 3601 Tower of Hanoi
- Effecitive C++_Item20笔记
- 多线程——继承Thread 类和实现Runnable 接口的区别
- 公告
- JAVA ASCII码 读入字符串测试
- C与C++中的enum类型使用
- 在Ubuntu中安装Visual Studio Code
- Begin_With_AngularJS(1)基础:ng-app,ng-controller,代码分离,模板,作用域等
- 欧拉函数模板
- codeforces 589d(相遇问题)
- 分享| Go语言(golang)的认识,跟学习资料及其开发工具
- 【u119】中位数
- Scala 提取器与注解深度解析之编程进阶(6)