Java tutorial
//package com.java2s; public class Main { public static boolean fileIsJpeg(String fn) { String suff = fn.substring(fn.lastIndexOf('.') + 1).toLowerCase(); if (" .jpeg .jpg".indexOf(suff) > 0) return true; else return false; } }