public static int keyCodeFor(char keyCode) throws SelendroidException {
    // see whether char is a special key; if so, return that
    for (AndroidKeys key : AndroidKeys.values()) {
      if (key.charAt(0) == keyCode) {
        return key.getAndroidKeyCode();
      }
    }

    // otherwise, figure out corresponding KeyEvent integer
    char upperCaseKey = Character.toUpperCase(keyCode);
    if (Character.isDigit(upperCaseKey)) {
      return upperCaseKey - '0' + KeyEvent.KEYCODE_0;
    }
    if (Character.isLetter(upperCaseKey)) {
      return upperCaseKey - 'A' + KeyEvent.KEYCODE_A;
    }
    throw new SelendroidException("Character '" + keyCode + "' is not yet "
        + "supported by Selendroid.");
  }
Returns a character's corresponding Android {@code KeyEvent} code.

@param keyCode character to get {@code KeyEvent} code for
@return integer representing {@code KeyEvent} code
selendroid-server/src/main/java/io/selendroid/server/android/AndroidKeys.java