Here you can find the source of getFileExtension(File file, boolean includeDot)
public static String getFileExtension(File file, boolean includeDot)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String getFileExtension(File file, boolean includeDot) { return getFileExtension(file.getName(), includeDot); }/* ww w .j av a2 s. c o m*/ public static String getFileExtension(String fileName, boolean includeDot) { int pos = fileName.lastIndexOf('.'); if (!includeDot) pos = pos + 1; return fileName.substring(pos, fileName.length()); } }