public static String getLastName(String fullName) {
      if (fullName.contains(",")) {// assuming lastName first then firstName maybe as initial or with middle name
         // initial
         return fullName.substring(0, fullName.indexOf(","));
      } else if (!fullName.contains(".") && fullName.contains(" ")) {// firstName first no initial, lastName last
         return fullName.substring(fullName.lastIndexOf(" ") + 1);
      } else if (fullName.contains(".") && !fullName.contains(" ")) {// has an initial, assume that the lastName
         // behind the dot.
         return fullName.substring(fullName.lastIndexOf(".") + 1);
      } else if (!fullName.contains(",") && !fullName.contains(" ")) {// is only one word, assumes that there is only
         // a last name
         return fullName;
      } else {// firstName first, maybe as initial or with intials, lastName last
         return fullName.substring(fullName.lastIndexOf(" ") + 1);
      }
   }