Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void mode() {
- int[] count = new int[100];
- int[] a = {27, 15, 15, 11, 27};
- int max = 0;
- for(int i = 0;i < a.length;i++){
- count[a[i]]++;
- }
- for(int i = 0;i < count.length;i++){
- if(count[i] > max){
- max = count[i];
- }
- }
- for(int i = 0;i < count.length;i++){
- if(count[i] == max){
- System.out.println(i);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement