Here you can find the source of isFileExists(String f, String ext)
public static File isFileExists(String f, String ext)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static File isFileExists(String f, String ext) { return isFileExists(new File(f), ext); }//from ww w . j ava 2s. co m public static File isFileExists(File f, String ext) { int point = f.getName().lastIndexOf('.'); if (point == -1) { point = f.getName().length(); } File lowerCasedFile = new File(f.getParentFile(), f.getName().substring(0, point) + "." + ext.toLowerCase()); if (lowerCasedFile.exists()) { return lowerCasedFile; } File upperCasedFile = new File(f.getParentFile(), f.getName().substring(0, point) + "." + ext.toUpperCase()); if (upperCasedFile.exists()) { return upperCasedFile; } return null; } }