code: public static String getExtension(String fileName){
          int dot = fileName.lastIndexOf('.');
          return dot==-1 ? null : fileName.substring(dot+1);
      }
docs: Returns extension of the file. Returns null if there is no extension