public static void main(String[] args) { // 定义数组,存储初始数字 int[] testArr1 = new int[4]; // 随机产生大于0的数字 Random r = new Random(); // 将数字存储到初始数组中去 System.out.print("加密但未反转的数据是:"); for (int i = 0; i < testArr1.length; i++) { testArr1[i] = r.nextInt(1, 9); // 对数字进行加密 testArr1[i] = (testArr1[i] + 5) % 10; System.out.print(testArr1[i]); } // 将数字进行反转 System.out.println(" "); System.out.print("反转后的数据是:"); for (int i = testArr1.length; i > 0; i--) { System.out.print(testArr1[i - 1]); } }
01-07
933
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-06
2643
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-06
797
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-11
3万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-06
1142
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)