String name = file.getName();
int index = name.lastIndexOf(".");
String endung = null;
if (index > -1 && index < name.length() - 1) {
endung = name.substring(index+ 1);
if (endung.equalsIgnoreCase("BMP")) {
} else if (endung.equalsIgnoreCase("JPG")) {
}
}