boolean (String packageName) { if (packageName.startsWith(myPackageName)) { if (packageName.length() == myPackageName.length()) return true; if (myWithSubpackages) { if (packageName.charAt(myPackageName.length()) == '.') return true; } } return false; }