private static long getLanguage(DirectoryEntry root) {
    // Language ID is Name of third level entries
    Set<Long> languages = new HashSet<>();

    // First search across icons only
    {
      DirectoryEntry first = root.findSubDir(DirectoryEntry.RT_ICON);
      for (DirectoryEntry second : first.getSubDirs()) {
        for (DataEntry third : second.getData()) {
          languages.add(third.getLanguage().getValue());
        }
      }
    }
    if (languages.size() == 1) {
      return languages.iterator().next();
    }

    // Then across whole file
    for (DirectoryEntry first : root.getSubDirs()) {
      for (DirectoryEntry second : first.getSubDirs()) {
        for (DataEntry third : second.getData()) {
          languages.add(third.getLanguage().getValue());
        }
      }
    }
    if (languages.size() != 1) {
      throw new IllegalStateException("There should be only one language in resources, but found: " + languages);
    }
    return languages.iterator().next();
  }
private static long getLanguage(DirectoryEntry root)