title: Get File Extension for special cases like tar.gz
body: <p>I need to extract extensions from file names.</p>
  
  <p>I know this can be done for single extensions like <code>.gz</code> or <code>.tar</code> by using <code>filePath.lastIndexOf('.')</code> or using utility methods like <code>FilenameUtils.getExtension(filePath)</code> from Apache commons-io.</p>
  
  <p><em>But</em>, what if I have a file with an extension like <code>.tar.gz</code>? How can I manage files with extensions that contain <code>.</code> characters?</p>