Java examples for java.lang:Math Matrix
rotate Matrix
//package com.java2s; public class Main { static int[][] rotateMatrix(int[][] arr) { int[][] tmp = new int[arr[0].length][arr.length]; for (int i = 0; i < arr[0].length; i++) { for (int j = 0; j < arr.length; j++) { tmp[i][j] = arr[arr.length - j - 1][i]; }//w w w .ja v a 2 s . c o m } return tmp; } }