Java tutorial
//package com.java2s; /* * Copyright (C) 2011 The LiteListen Project * * Licensed under the Mozilla Public Licence, version 1.1 (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.mozilla.org/MPL/MPL-1.1.html * * 2011 * Mozilla Public Licence 1.1 * * * * http://www.mozilla.org/MPL/MPL-1.1.html */ import java.io.File; public class Main { public static String GetMIMEType(File f) { String strSuffix = f.getName().substring(f.getName().lastIndexOf(".") + 1, f.getName().length()) .toLowerCase(); if (strSuffix.equals("apk")) return "application/vnd.android.package-archive"; else return "/*"; } }