Sample code written in Java. This method gets what the program's extension is.
private static String getSuffix(String FileName) {
if (FileName == null)
return null;
int point = FileName.lastIndexOf(".");
if (point != -1) {
return FileName.substring(point + 1);
}
return FileName;
}