Skip to main content

Java Array - finding the most repeated number and counting the number of times is repeated.

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
learnlots101
Offline
Joined: 2013-02-01

Hi, I am just starting to learn Java and I would like some help to find out the syntax and method to get the number most repeated in the int array:

int array[] = { 2,2,3,3,4,4,4,4,4,6};

also the count for the number to times the number 4 is repeated (5)

System.out.println(" 4 is the number most repeated 5 times");

Thanks in advance!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sudhir.mishra
Offline
Joined: 2013-02-01