I have a String which contains numbers in a comma separated form. and I want to extract the most appears numbers from the String.
For example I have a String like..
String str="1,2,3,4,5,6,7,19,18,4";
from the above str i need 4 because 4 is two times in str.
same as
String str2="1,2,3,4,6,4,3,9";
from the above str2 i need 3,4
In case of all numbers are unique then i need first one.
suggest me better approach.
Try Below Code
Below will be output
Let me know if there are any queries…
Cheers!!!