public static boolean checkFileName(String name){
  if (name.contains(".") || name.contains("<") || name.contains(">")|| name.contains(":")|| name.contains("\"")|| name.contains("\\")|| name.contains("/")|| name.contains("|")|| name.contains("?")|| name.contains("*")) {
    return false;
  }
  return true;
}

public static boolean checkFileName ( String name ) { if ( name . contains ( "." ) || name . contains ( "<" ) || name . contains ( ">" ) || name . contains ( ":" ) || name . contains ( "\"" ) || name . contains ( "\\" ) || name . contains ( "/" ) || name . contains ( "|" ) || name . contains ( "?" ) || name . contains ( "*" ) ) { return false ; } return true ; }
checks name for the file control characters :
