随机数字盲文翻译?

时间:2017-02-19 20:34:18

标签: java

我正在为Java编写盲文代码,但是当我的输入变大时,随机数字开始出现......任何已知原因?

public class Main {

    public static void main(String[] args) {
    String str = "";
    String plaintext = "osadihfoasdhfsadfaewfwaefawefawefa";
    int[] letters = {100000,110000,100100,100110,100010,110100,
                     110110,110010,010100,010110,101000,111000,
                     101100,101110,101010,111100,111110,111010,
                     011100,011110,101001,111001,010111,101101,
                     101111,101011};
    for (int i = 0; i < plaintext.length(); i++) {
        int num = plaintext.charAt(i);
        if (num < 91 && num > 64) {
          str += "000001";
          str += letters[num - 65];
        }
        else if (num == 32) {
          str += "000000";
        }
        else {
          str += letters[num - 97];
        }
    }
    System.out.println(str);
  }
}

输出为10101046721000001001104160110010110100101010100000467210011011001011010046721000001001101101001000001000104169110100416910000010001011010010000041691000101101001000004169100010110100100000

提前致谢!

0 个答案:

没有答案