class Solution {
public void rotate(int[][] matrix) {
int a=0,b=matrix.length-1,tmp;
while(a<=b)
{
for(int k=0;k<=b-a-1;k++)
{
tmp = matrix[a][a+k];
matrix[a][a+k] = matrix[b-k][a];
matrix[b-k][a] = matrix[b][b-k];
matrix[b][b-k] = matrix[a+k][b];
matrix[a+k][b] = tmp;
}
a++;
b--;
}
}
}