int类型转bytepublicstaticbyte[]int2byte(intres){byte[]targets=newbyte[4];targets[0]=(byte)(res&0xff);//最低位targets[1]=(byte)((res>>8)&0xff);//次低位targets[2]=(byte)((res>>16)&0xff);//次高位targets[3]=(byte)(res>>>24);//最高位,无符号右移。returntargets;}char转byte应该可以强转吧然后用System.arraycopy()方法把int转换的byte和强转的byte写进你的data里面然后通过socket的write()方法写过去服务器就收到了