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; } }