private static void checkGroups(String[] groups){
  SecurityManager sm=System.getSecurityManager();
  if (sm == null)   return;
  if (groups != null) {
    for (int i=0; i < groups.length; i++) {
      sm.checkPermission(new DiscoveryPermission(groups[i]));
    }
  }
 else {
    sm.checkPermission(new DiscoveryPermission("*"));
  }
}

private static void checkGroups ( String [ ] groups ) { SecurityManager sm = System . getSecurityManager ( ) ; if ( sm == null ) return ; if ( groups != null ) { for ( int i = 0 ; i < groups . length ; i ++ ) { sm . checkPermission ( new DiscoveryPermission ( groups [ i ] ) ) ; } } else { sm . checkPermission ( new DiscoveryPermission ( "*" ) ) ; } }
determines if the caller has discovery permission for each group .
