code: protected static String getFileType(String name) {
          // TODO: Handle things like tar.gz ??
          String[] tokens = name.split("\\.(?=[^\\.]+$)");
          if (tokens.length > 1) {
              return "." + tokens[tokens.length - 1].toLowerCase();
          }
          return "";
      }
docs: Simple regex based method to get the extension of a given file name.
  NOTE: This only fetches the last extension so foo.bar.ext will return
  '.ext' and foobar will return ''.
  
  @param name
  @return Extension in given file name.