android - How to count the highest variable Integer value -
i have 5 integers, equal 0:
- happy
- neutral
- sad
- angry
- stressed.
whenever user clicks on particular button (happy, sad, etc.) each of integers, 1 added. bit know how do.
here part need help. want count see variable has highest value, e.g. if 'happy' integer 5 , rest 3 'happy' highest. can if
statements, seem long have go through every integer. there faster way this?
put them list
, use collections.sort(myintegerlist, comparator.reverse());
the highest value can afterwards calling myintegerlist.get(0);
Comments
Post a Comment