小编Ale*_*lex的帖子

初始化二维数组 - 密码表

我需要创建一个密码表,但我不知道该怎么做。这段代码:

public class Prog3Cipher {
    // INSTANCE VARIABLES
    static char [ ] keyList; // VARIABLE DESCRIPTION COMMENT
    static char [ ][ ] cipherTable; // VARIABLE DESCRIPTION COMMENT
    String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    public Prog3Cipher( char code, String key ) {
        String[] keyList = new String []{"key"};
        cipherTable = new char[26][26];
        cipherTable[0][0] = 'H';
        for(int x = 0; x < cipherTable.length; x++){
            for(int y = 0; y < cipherTable.length; y++){
                cipherTable[x][y] = alpha.charAt(y);
            }
        }
        System.out.println(Arrays.deepToString(cipherTable));
    }
Run Code Online (Sandbox Code Playgroud)

输出:

[[A, B, C, D, …
Run Code Online (Sandbox Code Playgroud)

java arrays encryption multidimensional-array

3
推荐指数
1
解决办法
51
查看次数

标签 统计

arrays ×1

encryption ×1

java ×1

multidimensional-array ×1