package ru.matevosyan.lesson_5_Array;

public class ArrayRotate {

	private int MaxSize = 4;
	private int lastPosition = MaxSize - 1;
	private int level = 0;
	private int totLevel = MaxSize / 2;
	
	public int[][] rotateMatrix(int value[][]){
	
		while (level < totLevel) {
				
			for (int i = level; i < lastPosition; i++) {

					
				//this.swap(value[level][i], value[i][lastPosition]);
				//this.swap(value[level][i], value[lastPosition][lastPosition - i + level]);
				//this.swap(value[level][i], value[lastPosition - i + level][level]);

				this.swap(value, level, i, i, lastPosition);
				this.swap(value, level, i, lastPosition, lastPosition - i + level);
				this.swap(value, level, i , lastPosition - i + level, level);
											
			}

			level++;
			lastPosition--;
		}
		
		return value;
	
	}

	//public void swap(int i, int j){

		//int current = i;
		//i = j;
		//j = current;
	
	//}
	public void swap(int arr[][], int i, int j, int a, int b){

		int current = arr[i][j];
		arr[i][j] = arr[a][b];
		arr[a][b] = current;
	
	}

	
	

}
@@ -61,24 +61,65 @@
 ate %7B%0A%0A%09
-private 
+%0A%09public int%5B%5D%5B%5D rotateMatrix(int value%5B%5D%5B%5D)%7B%0A%0A%0A%09
 int MaxS
@@ -128,24 +128,16 @@
 e = 4;%0A%09
-private 
 int last
@@ -161,24 +161,16 @@
 e - 1;%0A%09
-private 
 int leve
@@ -181,16 +181,8 @@
 0;%0A%09
-private 
 int 
@@ -211,55 +211,8 @@
 ;%0A%09%0A
-%09public int%5B%5D%5B%5D rotateMatrix(int value%5B%5D%5B%5D)%7B%0A%09%0A
 %09%09wh
@@ -294,228 +294,8 @@
  %7B%0A%0A
-%09%09%09%09%09%0A%09%09%09%09//this.swap(value%5Blevel%5D%5Bi%5D, value%5Bi%5D%5BlastPosition%5D);%0A%09%09%09%09//this.swap(value%5Blevel%5D%5Bi%5D, value%5BlastPosition%5D%5BlastPosition - i + level%5D);%0A%09%09%09%09//this.swap(value%5Blevel%5D%5Bi%5D, value%5BlastPosition - i + level%5D%5Blevel%5D);%0A%0A
 %09%09%09%09
@@ -559,100 +559,8 @@
 %09%7D%0A%0A
-%09//public void swap(int i, int j)%7B%0A%0A%09%09//int current = i;%0A%09%09//i = j;%0A%09%09//j = current;%0A%09%0A%09//%7D%0A
 %09pub

add ArrayRotate.java