Java tutorial
//package com.java2s; public class Main { public static final int convertValueToList(CharSequence value, String[] options, int defaultValue) { if (null != value) { for (int i = 0; i < options.length; i++) { if (value.equals(options[i])) return i; } } return defaultValue; } }