当前位置:   article > 正文

控制台打印心形_cmd打印爱心

cmd打印爱心

;

打印心形代码

public class testfile {
    public static void main(String[] args) {
        System.out.println(callBack("*"));
    }
 
    public static String callBack(String input) {
 
        int[] array = { 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1,
                0, 0, 1, 1, 4, 5, 2, 3, 4, 1, 0, 1,
 
                0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0 };
 
        StringBuffer sb = new StringBuffer();
 
        for (int i = 0; i < array.length; i++) {
 
            if (i % 7 == 0)
 
                sb.append("  \n");
 
            if (array[i] == 0)
 
                sb.append("   ");
 
            else if (array[i] == 4)
 
                sb.append("  ");
 
            else if (array[i] == 5)
 
                sb.append(" I ");
 
            else if (array[i] == 2)
 
                sb.append("Love ");
 
            else if (array[i] == 3)
 
                sb.append("You");
 
            else
 
                sb.append("  " + input);
 
        }
 
        return sb.toString();
 
    }

}
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/646805
推荐阅读
相关标签
  

闽ICP备14008679号