public static void setBlacklist(SharedPreferences prefs, String languageCode, String blacklist) {
    if (languageCode.equals("afr")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_AFRIKAANS, blacklist).commit(); }
    else if (languageCode.equals("sqi")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_ALBANIAN, blacklist).commit(); }
    else if (languageCode.equals("ara")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_ARABIC, blacklist).commit(); }
    else if (languageCode.equals("aze")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_AZERI, blacklist).commit(); }
    else if (languageCode.equals("eus")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_BASQUE, blacklist).commit(); }
    else if (languageCode.equals("bel")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_BELARUSIAN, blacklist).commit(); }
    else if (languageCode.equals("ben")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_BENGALI, blacklist).commit(); }
    else if (languageCode.equals("bul")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_BULGARIAN, blacklist).commit(); }
    else if (languageCode.equals("cat")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_CATALAN, blacklist).commit(); }
    else if (languageCode.equals("chi_sim")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_CHINESE_SIMPLIFIED, blacklist).commit(); }
    else if (languageCode.equals("chi_tra")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_CHINESE_TRADITIONAL, blacklist).commit(); }
    else if (languageCode.equals("hrv")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_CROATIAN, blacklist).commit(); }
    else if (languageCode.equals("ces")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_CZECH, blacklist).commit(); }
    else if (languageCode.equals("dan")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_DANISH, blacklist).commit(); }
    else if (languageCode.equals("nld")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_DUTCH, blacklist).commit(); }
    else if (languageCode.equals("eng")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_ENGLISH, blacklist).commit(); }
    else if (languageCode.equals("est")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_ESTONIAN, blacklist).commit(); }
    else if (languageCode.equals("fin")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_FINNISH, blacklist).commit(); }
    else if (languageCode.equals("fra")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_FRENCH, blacklist).commit(); }
    else if (languageCode.equals("glg")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_GALICIAN, blacklist).commit(); }
    else if (languageCode.equals("deu")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_GERMAN, blacklist).commit(); }
    else if (languageCode.equals("ell")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_GREEK, blacklist).commit(); }
    else if (languageCode.equals("heb")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_HEBREW, blacklist).commit(); }
    else if (languageCode.equals("hin")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_HINDI, blacklist).commit(); }
    else if (languageCode.equals("hun")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_HUNGARIAN, blacklist).commit(); }
    else if (languageCode.equals("isl")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_ICELANDIC, blacklist).commit(); }
    else if (languageCode.equals("ind")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_INDONESIAN, blacklist).commit(); }
    else if (languageCode.equals("ita")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_ITALIAN, blacklist).commit(); }
    else if (languageCode.equals("jpn")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_JAPANESE, blacklist).commit(); }
    else if (languageCode.equals("kan")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_KANNADA, blacklist).commit(); }
    else if (languageCode.equals("kor")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_KOREAN, blacklist).commit(); }
    else if (languageCode.equals("lav")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_LATVIAN, blacklist).commit(); }
    else if (languageCode.equals("lit")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_LITHUANIAN, blacklist).commit(); }
    else if (languageCode.equals("mkd")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_MACEDONIAN, blacklist).commit(); }
    else if (languageCode.equals("msa")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_MALAY, blacklist).commit(); }
    else if (languageCode.equals("mal")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_MALAYALAM, blacklist).commit(); }
    else if (languageCode.equals("mlt")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_MALTESE, blacklist).commit(); }
    else if (languageCode.equals("nor")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_NORWEGIAN, blacklist).commit(); }
    else if (languageCode.equals("pol")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_POLISH, blacklist).commit(); }
    else if (languageCode.equals("por")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_PORTUGUESE, blacklist).commit(); }
    else if (languageCode.equals("ron")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_ROMANIAN, blacklist).commit(); }
    else if (languageCode.equals("rus")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_RUSSIAN, blacklist).commit(); }
    else if (languageCode.equals("srp")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_SERBIAN, blacklist).commit(); }
    else if (languageCode.equals("slk")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_SLOVAK, blacklist).commit(); }
    else if (languageCode.equals("slv")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_SLOVENIAN, blacklist).commit(); }
    else if (languageCode.equals("spa")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_SPANISH, blacklist).commit(); }
    else if (languageCode.equals("swa")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_SWAHILI, blacklist).commit(); }
    else if (languageCode.equals("swe")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_SWEDISH, blacklist).commit(); }
    else if (languageCode.equals("tgl")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_TAGALOG, blacklist).commit(); }
    else if (languageCode.equals("tam")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_TAMIL, blacklist).commit(); }
    else if (languageCode.equals("tel")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_TELUGU, blacklist).commit(); }
    else if (languageCode.equals("tha")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_THAI, blacklist).commit(); }
    else if (languageCode.equals("tur")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_TURKISH, blacklist).commit(); }
    else if (languageCode.equals("ukr")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_UKRAINIAN, blacklist).commit(); }
    else if (languageCode.equals("vie")) { prefs.edit().putString(KEY_CHARACTER_BLACKLIST_VIETNAMESE, blacklist).commit(); }
    else {
      throw new IllegalArgumentException();
    }    
  }
Helper class to enable language-specific character blacklists/whitelists.
OCRTest/src/main/java/edu/sfsu/cs/orange/ocr/OcrCharacterHelper.java