java实现控制台打印进度条,清屏

package com.example.print;
/*
.......................阿弥陀佛......................
.                       _oo0oo_                      .
.                      o8888888o                     .
.                      88" . "88                     .
.                      (| -_- |)                     .
.                      0\  =  \0                     .
.                   ___\‘---’\___                   .
.                  .' \|       |\ '.                 .
.                 \ \\|||  :  |||\\ \                .
.                \ _||||| -卍-|||||_ \               .
.               |   | \\\  -  \\\ |   |              .
.               | \_|  ''\---\''  |_\ |              .
.               \  .-\__  '-'  ___\-. \              .
.             ___'. .'  \--.--\  '. .'___            .
.         ."" ‘<  ‘.___\_<|>_\___.’>’ "".          .
.       | | :  ‘- \‘.;‘\ _ \’;.’\ - ’ : | |        .
.         \  \ ‘_.   \_ __\ \__ _\   .-’ \  \        .
.    =====‘-.____‘.___ \_____\___.-’___.-’=====     .
.                       ‘=---=’                      .
.                                                    .
.....................佛祖保佑 ,永无BUG..................
*/

/**
 * @author 陈毅程  at  2019\6\12 14:32
 * contact by QQ:2446762079
 * contact by 微信:cyc2446762079
 */
public class Print_Text {
    
    public static void main(String[] args) {
        final long size = 1000L;
        for (int i = 0; i < 101; i++) {
            String tu = "▧";
            for (int j = 0; j < i / 10; j++) {
                tu += "▧";
            }
            System.out.print("\r当前进度:" + (i) + "%\t" + tu + "\t" + (i * 10) + "/" + size);
            try {
                Thread.sleep(50);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }


}

猜你喜欢

转载自blog.csdn.net/qq_41426326/article/details/91541985