code: public static boolean isValidFileExtension(String extension) {
          for (int i = 0; i < extension.length(); i++) {
              char c = extension.charAt(i);
              if (!(Character.isDigit(c) || Character.isLetter(c) || c == '_')) {
                  return false;
              }
          }
          return true;
      }
docs: Checks if the extension is valid.  This method only permits letters, digits,
  and an underscore character.
  @param extension The file extension to validate
  @return True if its valid, otherwise false