for(int i=0;i<100;i++) {
String str = String.format("%1$-40s","Reading... ") + i + "%";
System.out.print(str);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (!str.isEmpty()) {
for(int j=0;j>str.length();j++) {
System.out.print("\b");
}
}
}
沒有留言:
張貼留言