Maskfield selected values

I have a mask field, filed with strings (Array).

The selection returns an int as the documentation says : MaskField

How can I get the selected values in my string array using this int ?

Thanks a lot.

I found how to do it :

ArrayList maGroupNames; // This is my array of options (string)
int mCategory; // This is my maskfield's result

   	for (int i = 0; i < maGroupNames.Count; i++)
   		int layer = 1 << i;
   		if ((mCategory & layer) != 0)
   			//This group is selected