code: public static char getFirstChar(String strMenu, char[] rgChars, boolean bResetCache)
      {
          if (bResetCache) if (rgChars != null)
          {
              for (int i = 0; i < rgChars.length; i++)
                  rgChars[i] = 0;
          }
          if (strMenu != null)
          {
              for (int iCharPosition = 0; iCharPosition < strMenu.length(); iCharPosition++)
              {
                  char chShortcut = strMenu.charAt(iCharPosition);
                  char chShortcutCompare = Character.toUpperCase(chShortcut);
                  if (rgChars != null)    // Make sure this shortcut has not been used
                      for (int i = 0; i < rgChars.length; i++)
                      {
                          if (rgChars[i] == 0)
                          {
                              rgChars[i] = chShortcutCompare;
                              return chShortcut;  // End of cache (success)
                          }
                          if (rgChars[i] == chShortcutCompare)
                              break;  // Continue search (This char already used)
                      }
              }
          }
          return NO_CHAR; // No first char found
      }
docs: Get the appropriate keyboard shortcut character (that hasn't been used in this group).
  @param strMenu Menu string (try to use first character).
  @param rgChars Currently used characters.
  @param bResetCache First item on menu, reset rgChars.