public static String getWhitelist(SharedPreferences prefs, String languageCode) {
    if (languageCode.equals("afr")) { return prefs.getString(KEY_CHARACTER_WHITELIST_AFRIKAANS, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("sqi")) { return prefs.getString(KEY_CHARACTER_WHITELIST_ALBANIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("ara")) { return prefs.getString(KEY_CHARACTER_WHITELIST_ARABIC, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("aze")) { return prefs.getString(KEY_CHARACTER_WHITELIST_AZERI, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("eus")) { return prefs.getString(KEY_CHARACTER_WHITELIST_BASQUE, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("bel")) { return prefs.getString(KEY_CHARACTER_WHITELIST_BELARUSIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("ben")) { return prefs.getString(KEY_CHARACTER_WHITELIST_BENGALI, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("bul")) { return prefs.getString(KEY_CHARACTER_WHITELIST_BULGARIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("cat")) { return prefs.getString(KEY_CHARACTER_WHITELIST_CATALAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("chi_sim")) { return prefs.getString(KEY_CHARACTER_WHITELIST_CHINESE_SIMPLIFIED, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("chi_tra")) { return prefs.getString(KEY_CHARACTER_WHITELIST_CHINESE_TRADITIONAL, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("hrv")) { return prefs.getString(KEY_CHARACTER_WHITELIST_CROATIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("ces")) { return prefs.getString(KEY_CHARACTER_WHITELIST_CZECH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("dan")) { return prefs.getString(KEY_CHARACTER_WHITELIST_DANISH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("nld")) { return prefs.getString(KEY_CHARACTER_WHITELIST_DUTCH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("eng")) { return prefs.getString(KEY_CHARACTER_WHITELIST_ENGLISH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("est")) { return prefs.getString(KEY_CHARACTER_WHITELIST_ESTONIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("fin")) { return prefs.getString(KEY_CHARACTER_WHITELIST_FINNISH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("fra")) { return prefs.getString(KEY_CHARACTER_WHITELIST_FRENCH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("glg")) { return prefs.getString(KEY_CHARACTER_WHITELIST_GALICIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("deu")) { return prefs.getString(KEY_CHARACTER_WHITELIST_GERMAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("ell")) { return prefs.getString(KEY_CHARACTER_WHITELIST_GREEK, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("heb")) { return prefs.getString(KEY_CHARACTER_WHITELIST_HEBREW, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("hin")) { return prefs.getString(KEY_CHARACTER_WHITELIST_HINDI, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("hun")) { return prefs.getString(KEY_CHARACTER_WHITELIST_HUNGARIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("isl")) { return prefs.getString(KEY_CHARACTER_WHITELIST_ICELANDIC, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("ind")) { return prefs.getString(KEY_CHARACTER_WHITELIST_INDONESIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("ita")) { return prefs.getString(KEY_CHARACTER_WHITELIST_ITALIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("jpn")) { return prefs.getString(KEY_CHARACTER_WHITELIST_JAPANESE, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("kan")) { return prefs.getString(KEY_CHARACTER_WHITELIST_KANNADA, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("kor")) { return prefs.getString(KEY_CHARACTER_WHITELIST_KOREAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("lav")) { return prefs.getString(KEY_CHARACTER_WHITELIST_LATVIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("lit")) { return prefs.getString(KEY_CHARACTER_WHITELIST_LITHUANIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("mkd")) { return prefs.getString(KEY_CHARACTER_WHITELIST_MACEDONIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("msa")) { return prefs.getString(KEY_CHARACTER_WHITELIST_MALAY, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("mal")) { return prefs.getString(KEY_CHARACTER_WHITELIST_MALAYALAM, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("mlt")) { return prefs.getString(KEY_CHARACTER_WHITELIST_MALTESE, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("nor")) { return prefs.getString(KEY_CHARACTER_WHITELIST_NORWEGIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("pol")) { return prefs.getString(KEY_CHARACTER_WHITELIST_POLISH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("por")) { return prefs.getString(KEY_CHARACTER_WHITELIST_PORTUGUESE, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("ron")) { return prefs.getString(KEY_CHARACTER_WHITELIST_ROMANIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("rus")) { return prefs.getString(KEY_CHARACTER_WHITELIST_RUSSIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("srp")) { return prefs.getString(KEY_CHARACTER_WHITELIST_SERBIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("slk")) { return prefs.getString(KEY_CHARACTER_WHITELIST_SLOVAK, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("slv")) { return prefs.getString(KEY_CHARACTER_WHITELIST_SLOVENIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("spa")) { return prefs.getString(KEY_CHARACTER_WHITELIST_SPANISH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("swa")) { return prefs.getString(KEY_CHARACTER_WHITELIST_SWAHILI, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("swe")) { return prefs.getString(KEY_CHARACTER_WHITELIST_SWEDISH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("tgl")) { return prefs.getString(KEY_CHARACTER_WHITELIST_TAGALOG, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("tam")) { return prefs.getString(KEY_CHARACTER_WHITELIST_TAMIL, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("tel")) { return prefs.getString(KEY_CHARACTER_WHITELIST_TELUGU, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("tha")) { return prefs.getString(KEY_CHARACTER_WHITELIST_THAI, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("tur")) { return prefs.getString(KEY_CHARACTER_WHITELIST_TURKISH, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("ukr")) { return prefs.getString(KEY_CHARACTER_WHITELIST_UKRAINIAN, getDefaultWhitelist(languageCode)); }
    else if (languageCode.equals("vie")) { return prefs.getString(KEY_CHARACTER_WHITELIST_VIETNAMESE, getDefaultWhitelist(languageCode)); }
    else {
      throw new IllegalArgumentException();
    }        
  }
Helper class to enable language-specific character blacklists/whitelists.
OCRTest/src/main/java/edu/sfsu/cs/orange/ocr/OcrCharacterHelper.java