public static String[] filterPermissions(Context context,String[] permissions,int filter){
  final ArrayList<String> filtered=new ArrayList<>();
  for (  String permission : permissions) {
    if (getPermissionGrant(context,permission) == filter) {
      filtered.add(permission);
    }
  }
  return filtered.toArray(new String[filtered.size()]);
}

public static String [ ] filterPermissions ( Context context , String [ ] permissions , int filter ) { final ArrayList < String > filtered = new ArrayList < > ( ) ; for ( String permission : permissions ) { if ( getPermissionGrant ( context , permission ) == filter ) { filtered . add ( permission ) ; } } return filtered . toArray ( new String [ filtered . size ( ) ] ) ; }
filters all provided permissions and returns only granted or denied .
