Java examples for java.lang:Math Matrix
matrix rotate Clock Wise
//package com.java2s; public class Main { public static boolean[][] rotateClockWise(boolean[][] matrix) { final int height = matrix.length; final int width = matrix[0].length; boolean[][] ret = new boolean[width][height]; for (int verticalIndex = 0; verticalIndex < height; verticalIndex++) { for (int horizontalIndex = 0; horizontalIndex < width; horizontalIndex++) { ret[horizontalIndex][height - 1 - verticalIndex] = matrix[verticalIndex][horizontalIndex]; }//from w w w. java 2 s . c o m } return ret; } }