code: public static String getPackageName(String classFullName) {
      int lastDot = classFullName.lastIndexOf('.');
      return (lastDot < 0) ? "" : classFullName.substring(0, lastDot);
    }
docs: Returns the package name of {@code classFullName} according to the Java Language Specification
  (section 6.7). Unlike {@link Class#getPackage}, this method only parses the class name, without
  attempting to define the {@link Package} and hence load files.