Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 20, 2020 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/e9fca405089477911a4da412b9c65ff1 to your computer and use it in GitHub Desktop.
Save parzibyte/e9fca405089477911a4da412b9c65ff1 to your computer and use it in GitHub Desktop.
int moda = 0, mayor = 0;
for (HashMap.Entry<Integer, Integer> entry : mapa.entrySet()) {
if (entry.getValue() > mayor) {
mayor = entry.getValue();
moda = entry.getKey();
}
}
System.out.printf("La moda es %d porque se repite %d veces", moda, mayor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment