public static String getAName(String fullName,int type) {
    	String [] names=fullName.split(" ");
    	if(type==1)
    		return names[0];
    	else if(type==2 && names.length>=2) 
    		return names[names.length-1];
    	else if (type==3 && names.length>=3) {
    		String middleName="";
    		for(int i=1;i<names.length-1;i++) {
    			if(names[i].length()==0)
    				continue;
    			if (middleName.length()==0)
    				middleName=names[i].replace(" ", "");
    			else
    				middleName+=" "+names[i].replace(" ", "");
    		}
    		return middleName;
    	}
    	return "";
    }