public static String getPackageName(String className) {
        if (className == null || className.length() == 0) {
            return StringUtils.EMPTY;
        }

        // Strip array encoding
        while (className.charAt(0) == '[') {
            className = className.substring(1);
        }
        // Strip Object type encoding
        if (className.charAt(0) == 'L' && className.charAt(className.length() - 1) == ';') {
            className = className.substring(1);
        }

        int i = className.lastIndexOf(PACKAGE_SEPARATOR_CHAR);
        if (i == -1) {
            return StringUtils.EMPTY;
        }
        return className.substring(0, i);
    }
<p>Gets the package name from a {@code String}.</p>

<p>The string passed in is assumed to be a class name - it is not checked.</p>
<p>If the class is unpackaged, return an empty string.</p>

@param className  the className to get the package name for, may be {@code null}
@return the package name or an empty string
android/android_framework/base/src/main/java/lang3/ClassUtils.java