当前位置: 代码迷 >> J2SE >> 大伙儿帮忙呢,编个程序,打印输出“I love you”,用图形符号“*”组合拼出
  详细解决方案

大伙儿帮忙呢,编个程序,打印输出“I love you”,用图形符号“*”组合拼出

热度:553   发布时间:2016-04-24 13:11:09.0
大家帮忙呢,编个程序,打印输出“I love you”,用图形符号“*”组合拼出?
大家帮忙呢,编个程序,打印输出“I love you”,用图形符号“*”组合拼出?大家出招啊,小弟刚学j2se

------解决方案--------------------
利用 16 点阵字母字模做了一个:

Java code
import java.util.ArrayList;import java.util.List;public class Test {    public static void main(String[] args) {        int[] LETTER_I = {0x0000,0x0000,0x0000,0x1FF8,0x01C0,0x01C0,0x01C0,0x01C0,                          0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x1FFC,0x0000,0x0000};        int[] LETTER_l = {0x0000,0x0000,0x0080,0x0FC0,0x01C0,0x01C0,0x01C0,0x01C0,                          0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x1FFC,0x0000,0x0000};        int[] LETTER_o = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03E0,0x0F78,                          0x380C,0x300E,0x700E,0x380E,0x181C,0x0FF0,0x0000,0x0000};        int[] LETTER_v = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3E1E,0x3E1E,                          0x0C18,0x0E30,0x0720,0x0360,0x03C0,0x0180,0x0000,0x0000};        int[] LETTER_e = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03E0,0x0F78,                          0x180C,0x3FFE,0x3FFC,0x3800,0x1C0C,0x07F0,0x0000,0x0000};        int[] LETTER_y = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3E3E,0x3E3E,                          0x0E18,0x0630,0x0360,0x03E0,0x01C0,0x0180,0x1900,0x3E00};        int[] LETTER_u = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x783C,0x783C,                          0x181C,0x181C,0x181C,0x181C,0x183C,0x0FDE,0x0000,0x0000};        int[] SPACE    = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};        List<int[]> list = new ArrayList<int[]>();        list.add(LETTER_I);        list.add(SPACE);        list.add(LETTER_l);        list.add(LETTER_o);        list.add(LETTER_v);        list.add(LETTER_e);        list.add(SPACE);        list.add(LETTER_y);        list.add(LETTER_o);        list.add(LETTER_u);        for(int i = 0; i < 16; i++) {            for(int j = 0, k = list.size(); j < k; j++) {                int[] tmp = list.get(j);                int len = tmp == SPACE ? 8 : 16;                int[] letter = tmp.clone();                for(int m = 0; m < len; m++ ) {                    System.out.print(((letter[i] <<= 1) & 0x8000) == 0 ? " " : "#");                }            }            System.out.println();        }    }}
  相关解决方案