小弟刚刚接触JAVA,请大虾帮忙分析下面代码,
int 变成 String 有什么影响??
int xmlLen = 80 + xmlBody.getBytes().length;
String headLen = Integer.toString(xmlLen);
int num = 6-headLen.length();
------解决方案--------------------
int xmlLen = 80 + xmlBody.getBytes().length;
----------------------
80 + xmlBody的长度 , 假定xlBody的长度是10 则 xmllen = 90
String headLen = Integer.toString(xmlLen);
-------------------------------
headLen = "90 "
int num = 6-headLen.length();
--------------------------
num = 6 - 2 (因为 "90 "的长度为两位)