i am having problem in adjusting with program spacing. as i am taking numbers from user like random numbers 2 4 7 1 9.. as the space size of space character and star characters are different. the view of my result is not as i want. like in 2 4.. the stars above 4 after 2 is not in a proper vertical row..
here is a screenshot:
Do send the solutions to make the output exactly in vertical row
public void show(View v)
{
for(int i:al)
{
item=i;
total++;
if(item>max)
max=item;
}
value=new int[al.size()];
maxindex=al.indexOf(max);
for(int i=0;i<total;i++)
{
value[i]=al.get(i);
}
for(int i=1;i<=max;i++)
{
for(int j=0;j<total;j++)
{
if(i>max-value[j])
{
sb.append('*');
}
else
//while(i<=max-value[j])
{
sb.append(' ');
}
}
sb.append("\n");
}
for(int i=0;i<total;i++)
{
ar.append(value[i]);
}
show.setText(sb+"\n"+ar);
}**strong text**