hi i made a program that counts the elements in an array and i done it already. Now i want to display the result in a textView.. I want to display it this way...
1 appeared 2times
2 appeared 1times
3 appeared 1times
6 appeared 1times
this is my code..
The last element only displays in the textView..
please help me..Thanks
String []values = ( input.getText().toString().split(","));
Arrays.sort(values);
int c=1,i=0,range=4;
while(i<values.length-1){
while(values[i]==values[i+1]){
c++;
i++;
}
jLabel7.setText(values[i] + " appeared " + c + " times");
c=1;
i++;
if(i==values.length-1)
jLabel7.setText(values[i] + " appeared " + c + " times");
}