public String toBytes(){
        char[] c = new char[44];
        char[] o = new char[255];
        String res = "";
        String tmp;
        int optIdx = 0;
        
        //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        //|     op (1)    |   htype (1)   |   hlen (1)    |   hops (1)    |
        c[0] = (char)op;
        c[1] = 1;
        c[2] = 6;
        c[3] = 0;
        //|                            xid (4)                            |
        //c[4-5-6-7]
        c[4] = (char)((xid >> 24) & 0xFF);
        c[5] = (char)((xid >> 16) & 0xFF);
        c[6] = (char)((xid >> 8) & 0xFF);
        c[7] = (char)((xid) & 0xFF);        
        //|           secs (2)            |           flags (2)           |
        c[8] = c[9] = c[10] = c[11] = 0;
        //|                          ciaddr  (4)                          |
        tmp = convertIP(ciaddr);
        c[12] = tmp.charAt(0);
        c[13] = tmp.charAt(1);
        c[14] = tmp.charAt(2);
        c[15] = tmp.charAt(3);
        //|                          yiaddr  (4)                          |
        tmp = convertIP(yiaddr);
        c[16] = tmp.charAt(0);
        c[17] = tmp.charAt(1);
        c[18] = tmp.charAt(2);
        c[19] = tmp.charAt(3);        
        //|                          siaddr  (4)                          |
        c[20] = c[21] = c[22] = c[23] = 0;
        //|                          giaddr  (4)                          |
        c[24] = c[25] = c[26] = c[27] = 0;
        //|                                                               |
        //|                          chaddr  (16)                         |
        //|                                                               |
        //|                                                               |
        
        try{
            tmp = convertMAC(chaddr);
        }catch(Exception e){
            System.out.println(e.toString());            
        }
        c[28] = tmp.charAt(0);
        c[29] = tmp.charAt(1);
        c[30] = tmp.charAt(2);
        c[31] = tmp.charAt(3);
        c[32] = tmp.charAt(4);
        c[33] = tmp.charAt(5);     
        c[34] = c[35] = c[36] = c[37] = c[38] = c[39] = c[40] = c[41] = c[42] = c[43] = 0;
        
        res = String.copyValueOf(c,0,44);               
        
        for(int i = 0; i<192; i++){
            res += " ";
        }
        
        // "magic number"
        o[0] =  99;
        o[1] = 130;
        o[2] = 83;
        o[3] = 99;
        optIdx = 4;
        
        //DHCP Message Type
        if(msgType>0){
            o[optIdx++] = 53;
            o[optIdx++] = 1;
            o[optIdx++] = (char)msgType;
        }
        
        if(WantedIP!=""){
            o[optIdx++] = 50;
            o[optIdx++] = 4;
            tmp = convertIP(WantedIP);
            o[optIdx++] = tmp.charAt(0);
            o[optIdx++] = tmp.charAt(1);
            o[optIdx++] = tmp.charAt(2);
            o[optIdx++] = tmp.charAt(3);  
        }
        
        if(SubnetMask!=""){
            o[optIdx++] = 1;
            o[optIdx++] = 4;
            tmp = convertIP(SubnetMask);
            o[optIdx++] = tmp.charAt(0);
            o[optIdx++] = tmp.charAt(1);
            o[optIdx++] = tmp.charAt(2);
            o[optIdx++] = tmp.charAt(3);  
        }
        
        if(Gateway!=""){
            o[optIdx++] = 3;
            o[optIdx++] = 4;
            tmp = convertIP(Gateway);
            o[optIdx++] = tmp.charAt(0);
            o[optIdx++] = tmp.charAt(1);
            o[optIdx++] = tmp.charAt(2);
            o[optIdx++] = tmp.charAt(3);  
        }
        
        if(leaseTime>=0){
            o[optIdx++] = 51;
            o[optIdx++] = 4;
            //tmp = Long.valueOf(leaseTime). ;
            o[optIdx++] = (char)((leaseTime >> 24) & 0xFF);
            o[optIdx++] = (char)((leaseTime >> 16) & 0xFF);
            o[optIdx++] = (char)((leaseTime >> 8) & 0xFF);
            o[optIdx++] = (char)((leaseTime) & 0xFF);
        }

        if(DHCPServer!=""){
            o[optIdx++] = 54;
            o[optIdx++] = 4;
            tmp = convertIP(DHCPServer);
            o[optIdx++] = tmp.charAt(0);
            o[optIdx++] = tmp.charAt(1);
            o[optIdx++] = tmp.charAt(2);
            o[optIdx++] = tmp.charAt(3);  
        }
        
        res += String.valueOf(o,0,optIdx);      
       
        /*for(int j=0; j<res.length(); j++){
           System.out.println(j + ":\t" + (short) res.charAt(j) );
        }*/
        
        return res;
    }