Print the astricks

Hi friends,

How to print the following format string="00122104"

0-***(occurs) 3 times
1-**
2-**
3-
4-*

I tried to split the string and then put it in array..Then didnt know how to proceed


class Test{

public static void main(String[]args){
int i;
String s1= "10012442test";
char [] t1 = new char [s1.length()];

for(i=0; i<t1.length;i++)
{
char aChar = s1.charAt(i);
t1[i] = aChar;
//System.out.println(t1[i]);
//for(i=0; i<t1.length;i++)
//for(int count=0;count<t1[i];count++)
//if(t1[i]=='0')
//System.out.print("*");
//System.out.println();
}

}

}
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories