code: public static String getBaseName(String fileName, String suffix) {
      String[] elts = fileName.split("/");
      String lastElt = elts[elts.length - 1];
      if (lastElt.endsWith(suffix)) {
        lastElt = lastElt.substring(0, lastElt.length() - suffix.length());
      }
      return lastElt;
    }
docs: Strip directory and suffix from filename.  Like Unix 'basename'. <p/>
  
  Example: <code>getBaseName("/u/wcmac/foo.txt", "") ==> "foo.txt"</code><br/>
  Example: <code>getBaseName("/u/wcmac/foo.txt", ".txt") ==> "foo"</code><br/>
  Example: <code>getBaseName("/u/wcmac/foo.txt", ".pdf") ==> "foo.txt"</code><br/>