code: public int getValue(String name, String[] choices) {
          String val = getValue(name, "");
          int index = Arrays.asList(choices).indexOf(val);
          return index == -1 ? 0 : index;
      }
docs: Returns the index of a property value as it occurs in the choice list.
  
  @param name Property name.
  @param choices Array of possible choice values. The first entry is assumed to be the default.
  @return Index of the property value in the choices array. Returns 0 if not found.