code: public static String getExtension(String filename)
     {
        int index = filename.lastIndexOf('.');
  
        if (index >= 0)
        {
           return filename.substring(index + 1);
        }
  
        return "";
     }
docs: Extracts the extension of the file.
  
  @param filename file name
  @return extension or emtpy string if file has no extension