static void stringToPacket(String s,DatagramPacket packet){
  byte[] bytes=s.getBytes();
  System.arraycopy(bytes,0,packet.getData(),0,bytes.length);
  packet.setLength(bytes.length);
}

static void stringToPacket ( String s , DatagramPacket packet ) { byte [ ] bytes = s . getBytes ( ) ; System . arraycopy ( bytes , 0 , packet . getData ( ) , 0 , bytes . length ) ; packet . setLength ( bytes . length ) ; }
converts a given string into a datagram packet .
