Java tutorial
//package com.java2s; public class Main { private static String getType(String path) { String type; type = ""; try { int pos = path.lastIndexOf("."); if (pos != -1) { type = path.substring(pos + 1); } } catch (Exception e) { e.printStackTrace(); } return type; } }