public String extractLastName(String fullName) {
        String lastName="";
        String msg="";
        //String temp="";
        //String pattern = "[a-zA-Z]"+ " " + "[a-zA-Z]";
        boolean nameRight=false;
        int j=0;
        
        do{
            if(fullName==null||fullName.length()==0){
                nameRight=false;
               msg=NULL_VAL;
            }else{
                for(int i=fullName.length()-1;i>=0;i--){
                    if(fullName.charAt(i)==32&&nameRight==false){
                        nameRight=true;
                        msg="";
                        //extract last name
                        for(j=i;j<fullName.length();j++){
                            lastName+=fullName.toCharArray()[j];
                        }
                    }
                 }
            }
        
            if(!nameRight){
                fullName = JOptionPane.showInputDialog(msg+REQUEST_FULL_NAME);
            }
        }while(!nameRight);
        
        
        return lastName;
        //String[] nameParts = fullName.split(" ");
        //return nameParts[LAST_NAME_IDX];
        //tried
        /*
         * else if(!fullName.matches(pattern)){
                    nameRight=false;
                    System.out.println("not matching pattern");
         */
    }