What I did up until now is following:
String fileName = \"file.date.txt\"; String ext = fileName.substring(fileName.lastIndexOf(\'.\') + 1); System.out.printf(\
No there is no more efficient/convenient way in JDK, but many libraries give you ready methods for this, like Guava: Files.getFileExtension(fileName) which wraps your code in single method (with additional validation).