public static byte[] agentOptionToRaw(Map<Byte, String> map) {
    	if (map == null) {
            return null;
        }
        ByteArrayOutputStream buf = new ByteArrayOutputStream(64);
        DataOutputStream out = new DataOutputStream(buf);
        try {
        	for (Entry<Byte, String> entry : map.entrySet()) {
	            byte[] bufTemp = DHCPPacket.stringToBytes(entry.getValue());
	            int size = bufTemp.length;
	            assert (size >= 0);
	            if (size > 255) {
	            	throw new IllegalArgumentException("Value size is greater then 255 bytes");
                }
	            out.writeByte(entry.getKey());
	            out.writeByte(size);
	            out.write(bufTemp, 0, size);
        	}
	        return buf.toByteArray();
	    } catch (IOException e) {
			logger.log(Level.SEVERE, "Unexpected IOException", e);
	        return buf.toByteArray();
	    }
    }