String packageName ( File file ) { String path = file . getAbsolutePath ( ) ; int begin = path . lastIndexOf ( File . separatorChar + "com" + File . separatorChar ) ; String packagePath = path . substring ( begin + 1 , path . lastIndexOf ( File . separatorChar ) ) ; String packageName = packagePath . replace ( File . separatorChar , ' ' ) ; return packageName ; }
Retrieve package part of given file object .