Java tutorial
//package com.java2s; public class Main { /** * judge whether is a pdf file. * * @param path the file path * @return true if it is a image file, otherwise false */ public static boolean isPdfFile(String path) { String extention = path.substring(path.lastIndexOf(".", path.length()) + 1, path.length()); if (extention.equalsIgnoreCase("pdf")) { return true; } return false; } }