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 ; }
Checks if the extension is valid . This method only permits letters digits and an underscore character .