text: public static String getExtension(String name) {int i = name.lastIndexOf('.');if (i == -1) {return "";}String ext = name.substring(i + 1);if (ext.equals("tmp")) {Matcher matcher = EXT_PATTERN.matcher(name.substring(0, i + 1));if (matcher.find()) {return matcher.group(1);}}return ext;}