diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-23 14:17:59 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-23 14:17:59 +0900 |
commit | fdc4638c4bbd84e1429812387d0f3a2626b95ae6 (patch) | |
tree | fdad2b2accbaef2303a98d2c7494ee6fa3a7fef7 /src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java | |
parent | bcf47265dc731b8124015756a0154bd25c2c7279 (diff) | |
download | Skyblock-Dungeons-Guide-fdc4638c4bbd84e1429812387d0f3a2626b95ae6.tar.gz Skyblock-Dungeons-Guide-fdc4638c4bbd84e1429812387d0f3a2626b95ae6.tar.bz2 Skyblock-Dungeons-Guide-fdc4638c4bbd84e1429812387d0f3a2626b95ae6.zip |
room building
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java new file mode 100644 index 00000000..7b9e8b59 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java @@ -0,0 +1,22 @@ +package kr.syeyoung.dungeonsguide.utils; + +public class ArrayUtils { + public static int[][] rotateCounterClockwise(int[][] arr) { + int[][] res = new int[arr[0].length][arr.length]; + for(int y=0; y<arr.length; y++) { + for (int x = 0; x< arr[0].length; x++) { + res[res.length - x - 1][y] = arr[y][x]; + } + } + return res; + } + public static int[][] rotateClockwise(int[][] arr) { + int[][] res = new int[arr[0].length][arr.length]; + for(int y=0; y<arr.length; y++) { + for (int x = 0; x< arr[0].length; x++) { + res[x][res[0].length - y - 1] = arr[y][x]; + } + } + return res; + } +} |