在对接短信接口中遇到的一堆问题!!!!(在线等待) 你遇到这种问题的时候,应该直接去找该公司的api提供技术人员 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String SPName = "softwife", SPPassword="softwife", SPType="sp"; byte pData[] = new byte[1024]; int iCount = 0 , i; int iCommandID = 0x1; byte command[] = new byte[4]; command[0] = (byte)( (iCommandID & 0xff000000) >>> 24); command[1] = (byte)( (iCommandID & 0x00ff0000) >>> 16); command[2] = (byte)( (iCommandID & 0x0000ff00) >>> 8); command[3] = (byte)( (iCommandID & 0x000000ff) ); byte name[] = SPName.getBytes(); int nameLen = SPName.length() + 1 ; byte password[] = SPPassword.getBytes(); int passwordLen = SPPassword.length() + 1; byte type[] = SPType.getBytes(); int typeLen = SPType.length() + 1; iCount = 4*2 + nameLen + passwordLen + typeLen; byte len[] = new byte[4]; len[0] = (byte)( (iCount & 0xff000000) >>> 24); len[1] = (byte)( (iCount & 0x00ff0000) >>> 16); len[2] = (byte)( (iCount & 0x0000ff00) >>> 8); len[3] = (byte)( (iCount & 0x000000ff) ); //数据的长度 for(i=0; i<4; i++){ pData[i] = len[i]; } //指令代码 for(i=0; i<4; i++){ pData[i+4] = command[i]; } //账号 for(i=0; i<nameLen-1; i++){ pData[i+8] = name[i]; } pData[8+nameLen-1] = 0; //密码 for(i=0; i<passwordLen-1; i++){ pData[i+8+nameLen] = password[i]; } pData[8+nameLen+passwordLen-1] = 0; //类型 for(i=0; i<typeLen-1; i++){ pData[i+8+nameLen+passwordLen] = type[i]; } pData[8+nameLen+passwordLen+typeLen-1] = 0; System.out.println("4444"); connection.send(pData); System.out.println("5555");================================================================其中 connection.send(pData); public void send(byte s[]) { writeThread.send(s);}??? 为什么 提示java.lang.NullPointerException at com.softwife.sms.SMSManager.login(SMSManager.java:115)郁闷ing... 上面问题解决但又有新问题怎么将 byte[4] 转换成 int下面错在那里int iCommandID; iCommandID = (command[0].intValue()) & ((command[1].intValue())<<<8) & ((command[2].intValue())<<<16) & ((command[3].intValue())<<<24) ; iCommandID = (command[0].intValue()) & ((command[1].intValue())<<<8) & ((command[2].intValue())<<<16) & ((command[3].intValue())<<<24) ; 想实现什么功能如果command[0].intValue()没错,那你自己考虑自己写程序的问题了 正则表达式如何表示要匹配无顺序字符呢? 数据库配置和连接问题 一段经典代码,说明yield的用法。。。。。 jtable可更新结果集需要最大化一次才能更新 求教一个输入问题 classpath 怎么直接包含 .class 文件 在方法里面把对象设成null(紧急) 利用JAVA开发windows应用程序(类似CS风格的程序)的可行性论证! 编译的问题 请高手们给菜鸟指点一下,多谢了定加分!!!! 请大家谈谈Java打印技术 哪里有可视化的jCheckTree组件?
byte pData[] = new byte[1024]; int iCount = 0 , i;
int iCommandID = 0x1; byte command[] = new byte[4];
command[0] = (byte)( (iCommandID & 0xff000000) >>> 24);
command[1] = (byte)( (iCommandID & 0x00ff0000) >>> 16);
command[2] = (byte)( (iCommandID & 0x0000ff00) >>> 8);
command[3] = (byte)( (iCommandID & 0x000000ff) ); byte name[] = SPName.getBytes();
int nameLen = SPName.length() + 1 ;
byte password[] = SPPassword.getBytes();
int passwordLen = SPPassword.length() + 1;
byte type[] = SPType.getBytes();
int typeLen = SPType.length() + 1;
iCount = 4*2 + nameLen + passwordLen + typeLen;
byte len[] = new byte[4];
len[0] = (byte)( (iCount & 0xff000000) >>> 24);
len[1] = (byte)( (iCount & 0x00ff0000) >>> 16);
len[2] = (byte)( (iCount & 0x0000ff00) >>> 8);
len[3] = (byte)( (iCount & 0x000000ff) ); //数据的长度
for(i=0; i<4; i++){
pData[i] = len[i];
}
//指令代码
for(i=0; i<4; i++){
pData[i+4] = command[i];
}
//账号
for(i=0; i<nameLen-1; i++){
pData[i+8] = name[i];
}
pData[8+nameLen-1] = 0;
//密码
for(i=0; i<passwordLen-1; i++){
pData[i+8+nameLen] = password[i];
}
pData[8+nameLen+passwordLen-1] = 0;
//类型
for(i=0; i<typeLen-1; i++){
pData[i+8+nameLen+passwordLen] = type[i];
}
pData[8+nameLen+passwordLen+typeLen-1] = 0; System.out.println("4444");
connection.send(pData);
System.out.println("5555");
================================================================
其中 connection.send(pData);
public void send(byte s[]) {
writeThread.send(s);
}
??? 为什么 提示
java.lang.NullPointerException
at com.softwife.sms.SMSManager.login(SMSManager.java:115)郁闷ing...
int iCommandID;
iCommandID = (command[0].intValue()) & ((command[1].intValue())<<<8) & ((command[2].intValue())<<<16) & ((command[3].intValue())<<<24) ;
如果
command[0].intValue()没错,那你自己考虑自己写程序的问题了