I need to extract extensions from file names.
I know this can be done for single extensions like .gz or .tar by using filePath.lastIndexOf('.') or using utility methods like FilenameUtils.getExtension(filePath) from Apache commons-io.
But, what if I have a file with an extension like .tar.gz? How can I manage files with extensions that contain . characters?