What I did up until now is following:
String fileName = \"file.date.txt\";
String ext = fileName.substring(fileName.lastIndexOf(\'.\') + 1);
System.out.printf(\
Use FilenameUtils.getExtension
from Apache Commons IO
Example:
You can provide full path name or only the file name.
String myString1 = FilenameUtils.getExtension("helloworld.exe"); // returns "exe"
String myString2 = FilenameUtils.getExtension("/home/abc/yey.xls"); // returns "xls"
Hope this helps ..