code: public static int permissionArray2Id(Permission[] permissions){
          int id = 0;
          if(permissions != null && permissions.length != 0){
              for (Permission p : permissions) {
                  id += p.getId();
              }
          }
          return id;
      }
docs: Transfer the Permission Array to id.
  
  @param permissions
  the Permission Array.
  @return
  the permission id.