private static final String toXml(int categories){
  StringBuilder sb=new StringBuilder();
  if ((categories & Integer.MAX_VALUE) == Integer.MAX_VALUE) {
    sb.append("<All" + " Value=\"" + Integer.MAX_VALUE + "\" />");
  }
 else {
    int mask=1;
    for (int i=1; i < 32; i++) {
      if ((categories & mask) == mask) {
        sb.append("<Group" + i + " Value=\""+ mask+ "\" />");
      }
      mask*=2;
    }
  }
  return sb.toString();
}

private static final String toXml ( int categories ) { StringBuilder sb = new StringBuilder ( ) ; if ( ( categories & Integer . MAX_VALUE ) == Integer . MAX_VALUE ) { sb . append ( "<All" + " Value=\"" + Integer . MAX_VALUE + "\" />" ) ; } else { int mask = 1 ; for ( int i = 1 ; i < 32 ; i ++ ) { if ( ( categories & mask ) == mask ) { sb . append ( "<Group" + i + " Value=\"" + mask + "\" />" ) ; } mask *= 2 ; } } return sb . toString ( ) ; }
returns the xml for all the categories for the given cateories int .
