This is a simple sample on how to do it. You have to implement the same logic in your algorithm.
Code:
public class Asterisk
{
public static void main(String[] args)
{
if(args.length == 0)
{
System.out.println("No arguments passed");
System.exit(-1);
}
try
{
long value = Long.valueOf(args[0]).longValue();
long hundreds = value / 100;
System.out.println("number of asterisks ["+hundreds+"]");
for(long i=0; i<hundreds; i++)
{
System.out.print("*");
}
}
catch(NumberFormatException ex)
{
ex.printStackTrace();
System.exit(-1);
}
}
}