My code is :
String str= (char)255 + (char)255 +"1" ;
byte[] sendbuf = str.getBytes();
outputPacket = new DatagramPacket(sendbuf,sendbuf.length,remoteIP,2280);
logSocket.send(outputPacket);
the result I get is “0x35 0x31 0x30 0x31”
but what I want is :0xff 0xff 0x31
How to do this?
Your
stris adding the twochars first, so it’s basically this:What you want is (something like) this:
Or, using
String.format: