Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/384.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何打印矩阵中每列的值?_Java_Loops - Fatal编程技术网

Java 如何打印矩阵中每列的值?

Java 如何打印矩阵中每列的值?,java,loops,Java,Loops,我有一个嵌套的for循环,在这里我调用了一些不同的方法。当我尝试使用Rainbow表时,需要按照我设置的顺序调用这些方法 所以,我有一个for循环,它生成一个3字节的键-这是第0列 在这个for循环中,我有另一个for循环,它使用AES加密一些数据,然后将输出限制为3个字节-AES-128需要至少16个字节的密钥,所以最后13个字节是0 我需要的帮助不是密码学,而是如何使用for循环设置打印每行中的每一列 我想要实现的是计算每列中唯一值的数量 DecimalFormat df = new

我有一个嵌套的for循环,在这里我调用了一些不同的方法。当我尝试使用Rainbow表时,需要按照我设置的顺序调用这些方法

所以,我有一个for循环,它生成一个3字节的键-这是第0列 在这个for循环中,我有另一个for循环,它使用AES加密一些数据,然后将输出限制为3个字节-AES-128需要至少16个字节的密钥,所以最后13个字节是0

我需要的帮助不是密码学,而是如何使用for循环设置打印每行中的每一列

我想要实现的是计算每列中唯一值的数量

    DecimalFormat df = new DecimalFormat(".##");
    for (int i = 0; i < 6; i++) {
        gKey(); // generates random 3 bytes

        for (int j = 1; j < 6; j++) {
            aesResult = aes.encrypt(keySet); // encrypts with 16 bytes keya and fixed plaintext, where the key's first 3 bytes are randomly generated the first time
            reduction(aesResult, j); // restricting the output

            System.out.println("Covered points "+ kStore); // kStore is a HashSet - I chose to use that as it is not allowed to have duplicates in HashSet. I basically store the keys in this HashSet in the reduction method
        }

这段代码将矩阵的行写入列中。读取矩阵的每一列并在每一行中写入

int [][] arr=new int[6][6];
for(int i = 0; i < arr.length; i++) {
   for(int j = 0; j < arr.length; j++) {
      System.out.print(arr[j][i]+" "); 
    }
   System.out.println(); 
}
int[]arr=newint[6][6];
对于(int i=0;i
此代码将矩阵的行写入列中。读取矩阵的每一列并在每一行中写入

int [][] arr=new int[6][6];
for(int i = 0; i < arr.length; i++) {
   for(int j = 0; j < arr.length; j++) {
      System.out.print(arr[j][i]+" "); 
    }
   System.out.println(); 
}
int[]arr=newint[6][6];
对于(int i=0;i
使用
打印(“值:+value+”);内部for循环,
很抱歉我的错误计算,但我需要的是打印每列中的所有行。已经更新了OP。你能更新小的输入和输出吗example@Deadpool:我没有真正的输出,因为我无法打印每列中的所有行。抱歉,我没有了解如何打印每列中的所有行,而不是每行中的每列。只需编写示例输出并在postuse中更新
print(值:“+value+”);内部为循环,
很抱歉我的错误计算,但我需要的是打印每列中的所有行。已更新OP。能否更新小的输入和输出example@Deadpool:我没有真正的输出,因为我无法打印每列中的所有行抱歉,我没有了解如何打印每列中的所有行n、 而不是每行中的每一列只需编写示例输出并在post中更新即可