aspose file tools
The moose likes Beginning Java and the fly likes Finding mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Finding mode" Watch "Finding mode" New topic

Finding mode

Kwesi Prat

Joined: Dec 02, 2003
Posts: 7
I am trying to figure out some coding on how to find mode for an array of integers? How do I go about the coding for mode?
Thank you.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

Welcome to JavaRanch!
If memory serves me right, the mode is the most common value, yes? Well, you loop over the array, and count the occurrences of each value.
Give it a try, come back and show us how far you get.

[Jess in Action][AskingGoodQuestions]
wood burning stoves
subject: Finding mode