I am trying to make a progress bar like this
[# ] 10%
[##### ] 50%
[#########] 100%
What i tried
public static void main(String[] args) throws InterruptedException {
String format = "[# ]%d%%\r";
for(int i=0;i<=100;i++){
System.out.print(String.format(format, i));
Thread.sleep(10);
}
}
output:
[# ] 10%
[# ] 50%
[# ] 100%
the problem is I can't increment the the #
count according to the progress.
So how can i move or increment the # ?