Here you can find the source of getFileExtension(File f)
public static String getFileExtension(File f)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static String getFileExtension(File f) { String[] split = f.getName().split("\\."); if (split.length > 1) { return split[1]; } else {//from w ww. jav a 2 s . c o m return null; } } }