public static String getMediaType(String ext) {
        String mediaType = "";

        // Find the media type value in the lookup table
        for (int i = 0; i < ApplicationMediaTypeMappings.length; i++) {
            if (ApplicationMediaTypeMappings[i][0].equals(ext.toLowerCase())) {
                mediaType = ApplicationMediaTypeMappings[i][1];
            }
        }

        // Give the media type default of "application/octet-stream"
        if (mediaType.equals("")) {
            mediaType = "application/octet-stream";
        }

        return mediaType;
    }
public static String getMediaType ( String ext ) { String mediaType = "" ; for ( int i = 0 ; i < ApplicationMediaTypeMappings . length ; i ++ ) { if ( ApplicationMediaTypeMappings [ i ] [ 0 ] . equals ( ext . toLowerCase ( ) ) ) { mediaType = ApplicationMediaTypeMappings [ i ] [ 1 ] ; } } if ( mediaType . equals ( "" ) ) { mediaType = "application/octet-stream" ; } return mediaType ; }
Returns the mime media type value for the given extension

@param ext
the filename extension to lookup
@return String the mime type for the given extension