如何使这个多维数组打印相反的数字

时间:2016-05-05 03:52:10

标签: java multidimensional-array

所以基本上这个Java程序打印

#!/bin/bash

echo "build script executing"

pwd
echo "ls /"
ls /

echo "***assembling the LyteByte asm files"

# move to the LyteByteAssember directory
cd ./LyteByteAssembler/

ASSEMBLY_FILE="LyteByteAssembly.lbasm"
MERGE_FILE="merge.lbasm"
OUTPUT_FILE="../BootloaderProj.cydsn/lytebyte_prog_mem_init.c"
TEMP_DIR="./"
PREPROCESSOR_DIRECTORY="c:/gitrepos/ArcherTools/LyteByteAsembler/LyteBytePreProcessor.py"

echo $PREPROCESSOR_DIRECTORY $ASSEMBLY_FILE $MERGE_FILE $TEMP_DIR
python "$PREPROCESSOR_DIRECTORY" "$ASSEMBLY_FILE" "$MERGE_FILE" "$TEMP_DIR"

if [ $? -eq 0 ]
then
     echo "Preprocessing succeeded!"
else
     echo "Preprocessing failed, process cancelled"
     exit 1
fi

但我必须让它打印

gitlab-ci-multi-runner 1.1.3 (a470667)
Using Shell executor...
Running on ip-172-31-7-232...
Fetching changes...
HEAD is now at d51e873 hjkj
From https://thing.githost.io/Firmware/PSoC5LP
   d51e873..d77e88b  CI         -> origin/CI
Checking out d77e88b0 as CI...
Previous HEAD position was d51e873... hjkj
HEAD is now at d77e88b... ;jkblkn .,/p
$ bash ./build_script.sh
build script executing
/home/gitlab-runner/builds/2b321e5b/0/Firmware/PSoC5LP
ls /
bin
boot
cgroup
dev
etc
home
lib
lib64
local
lost+found
media
mnt
opt
proc
root
run
sbin
selinux
srv
sys
tmp
usr
var
***assembling the LyteByte asm files
c:/gitrepos/ArcherTools/LyteByteAsembler/LyteBytePreProcessor.py LyteByteAssembly.lbasm merge.lbasm ./
python: can't open file 'c:/gitrepos/ArcherTools/LyteByteAsembler/LyteBytePreProcessor.py': [Errno 2] No such file or directory
Preprocessing failed, process cancelled

目前我在理解它时遇到了一些麻烦,如果有人能够逐步告诉我如何做到这一点会有所帮助。

43 
39 
71

2 个答案:

答案 0 :(得分:0)

只需颠倒循环的顺序。

int a[][] = {{4,2,7},
            {3,9,1}};
int j,i;
for(i = a[0].length - 1; i >= 0; i--)
{
    for(j = a.length - 1; j >= 0; j--)
        System.out.print(a[j][i]);
    System.out.println();
}

答案 1 :(得分:0)

  

您可以简单地反转循环。