public static String getExtension ( final String filename ) { Objects . requireNonNull ( filename , "filename cannot be null" ) ; int lastDotIdx = filename . lastIndexOf ( "." ) ; return lastDotIdx >= 0 ? filename . substring ( lastDotIdx ) : "" ; }
Returns the extension of a file including the dot .