public static String double2String(Double d){
return d==null? "0.00" : String.format("%.2f", d);
}
在报文前边加8位长度
public String dealMessageBeforeWriting(String reqMsg) {
String length = "";
try {
length = String.format("%1$08d", reqMsg.getBytes("UTF-8").length);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
reqMsg = length + reqMsg;
return reqMsg;
}