public static void checkPackageAccess(String name){
  SecurityManager s=System.getSecurityManager();
  if (s != null) {
    String cname=name.replace('/','.');
    if (cname.startsWith("[")) {
      int b=cname.lastIndexOf('[') + 2;
      if (b > 1 && b < cname.length()) {
        cname=cname.substring(b);
      }
    }
    int i=cname.lastIndexOf('.');
    if (i != -1) {
      s.checkPackageAccess(cname.substring(0,i));
    }
  }
}

public static void checkPackageAccess ( String name ) { SecurityManager s = System . getSecurityManager ( ) ; if ( s != null ) { String cname = name . replace ( '/' , '.' ) ; if ( cname . startsWith ( "[" ) ) { int b = cname . lastIndexOf ( '[' ) + 2 ; if ( b > 1 && b < cname . length ( ) ) { cname = cname . substring ( b ) ; } } int i = cname . lastIndexOf ( '.' ) ; if ( i != - 1 ) { s . checkPackageAccess ( cname . substring ( 0 , i ) ) ; } } }
checks package access on the given classname . this method is typically called when the class instance is not available and the caller attempts to load a class on behalf the true caller ( application ) .
