You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
995 B
Java
38 lines
995 B
Java
package com.company;
|
|
|
|
public class Rotieren {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
boolean[][] rotate = {
|
|
{true, false, false},
|
|
{false, true, false},
|
|
{false, false, true},
|
|
{false, false, false}
|
|
};
|
|
boolean[][] ausgabe = negativeRotation(rotate);
|
|
|
|
for (int i = 0; i < ausgabe.length; i++) {
|
|
for (int j = 0; j < ausgabe[0].length; j++) {
|
|
System.out.print(ausgabe[i][j] + " ");
|
|
}
|
|
System.out.println();
|
|
}
|
|
|
|
}
|
|
|
|
public static boolean[][] negativeRotation(boolean[][] rotating) {
|
|
|
|
boolean[][] arrayCopy;
|
|
arrayCopy = new boolean[rotating[0].length][rotating.length];
|
|
|
|
for (int i = 0; i < arrayCopy.length; i++) {
|
|
for (int j = 0; j < arrayCopy[0].length; j++) {
|
|
arrayCopy[i][j] = rotating[j][rotating[j].length - i - 1];
|
|
}
|
|
}
|
|
return arrayCopy;
|
|
}
|
|
}
|