private static String toAscii(BitMatrix bitMatrix) {
        StringBuilder sb = new StringBuilder();
        for (int rows = 0; rows < bitMatrix.getHeight(); rows++) {
            for (int cols = 0; cols < bitMatrix.getWidth(); cols++) {
                boolean x = bitMatrix.get(rows, cols);
                if (!x) {
                    // white
                    sb.append("\033[47m  \033[0m");
                } else {
                    sb.append("\033[30m  \033[0;39m");
                }
            }
            sb.append("\n");
        }
        return sb.toString();
    }
private static String toAscii(BitMatrix bitMatrix) {
        StringBuilder sb = new StringBuilder();
        for (int rows = 0; rows < bitMatrix.getHeight(); rows++) {
            for (int cols = 0; cols < bitMatrix.getWidth(); cols++) {
                boolean x = bitMatrix.get(rows, cols);
                if (!x) {
                    
                    sb.append("\033[47m  \033[0m");
                } else {
                    sb.append("\033[30m  \033[0;39m");
                }
            }
            sb.append("\n");
        }
        return sb.toString();
    }
private static String toAscii ( BitMatrix bitMatrix ) { StringBuilder sb = new StringBuilder ( ) ; for ( int rows = 0 ; rows < bitMatrix . getHeight ( ) ; rows ++ ) { for ( int cols = 0 ; cols < bitMatrix . getWidth ( ) ; cols ++ ) { boolean x = bitMatrix . get ( rows , cols ) ; if ( ! x ) { // white sb . append ( "\033[47m  \033[0m" ) ; } else { sb . append ( "\033[30m  \033[0;39m" ) ; } } sb . append ( "\n" ) ; } return sb . toString ( ) ; }
将二维码输出为 ASCII

@param bitMatrix
@return
将二维码输出为 ASCII