1package org.kodejava.example.lang;
2
3public class ConsoleProgressBar {
4 public static void main(String[] args) {
5 char[] animationChars = new char[]{'|', '/', '-', '\\'};
6
7 for (int i = 0; i <= 100; i++) {
8 System.out.print("Processing: " + i + "% " + animationChars[i % 4] + "\r");
9
10 try {
11 Thread.sleep(100);
12 } catch (InterruptedException e) {
13 e.printStackTrace();
14 }
15 }
16
17 System.out.println("Processing: Done! ");
18 }
19}
20