private String createAnswer(Answer ans)
    {
    	String resAnswer = createQuery(ans);
        resAnswer += IntToStr4(DNS_Message.TTL_DEFAULT);
        switch(ans.type){
            case A_QUERY_TYPE: {
            	String[] ip = ans.resource.split("\\.");
            	resAnswer += IntToStr2(4) + (char)Integer.parseInt(ip[0])
	            	+ (char)Integer.parseInt(ip[1])
	            	+ (char)Integer.parseInt(ip[2])
	            	+ (char)Integer.parseInt(ip[3]);
            	break;
            }
            case PTR_QUERY_TYPE: 
            case CNAME_QUERY_TYPE: {
            	String server = createDomainName(ans.resource);
            	String len = IntToStr2(server.length());
            	resAnswer += len + server;
            	break;
            }
            case HINFO_QUERY_TYPE: {
            	String hinfo = ans.resource.substring(0,Math.min(ans.resource.length(), 255));
            	String server = (char)hinfo.length() + hinfo;
            	String len = IntToStr2(server.length());
            	resAnswer += len + server;
            	break;
            }
            case MX_QUERY_TYPE: {
                String priority = IntToStr2(ans.priority);
                String server = createDomainName(ans.resource);
                String len = IntToStr2(server.length()+2);
                resAnswer += len + priority + server;
            	break;
            }
        }
        return resAnswer;
    }