private static String doGetPath(String filename,int separatorAdd){
  if (filename == null) {
    return null;
  }
  int prefix=getPrefixLength(filename);
  if (prefix < 0) {
    return null;
  }
  int index=indexOfLastSeparator(filename);
  int endIndex=index + separatorAdd;
  if (prefix >= filename.length() || index < 0 || prefix >= endIndex) {
    return "";
  }
  return filename.substring(prefix,endIndex);
}

private static String doGetPath ( String filename , int separatorAdd ) { if ( filename == null ) { return null ; } int prefix = getPrefixLength ( filename ) ; if ( prefix < 0 ) { return null ; } int index = indexOfLastSeparator ( filename ) ; int endIndex = index + separatorAdd ; if ( prefix >= filename . length ( ) || index < 0 || prefix >= endIndex ) { return "" ; } return filename . substring ( prefix , endIndex ) ; }
does the work of getting the path .
