I have a Java program running in command line mode. I would like to display a progress bar, showing the percentage of job done. The same kind of progress bar you would see u
public class ProgressBar
{
private int max;
public ProgressBar(int max0) {
max = max0;
update(0);
}
public void update(int perc) {
String toPrint = "|";
for(int i = 0; i < max; i++) {
if(i <= (perc + 1))
toPrint += "=";
else
toPrint += " ";
}
if(perc >= max)
Console.print("\r");
else
Console.print(toPrint + "|\r");
}
}