package ru.job4j;

/**.
*
* @author Anton Vasilyuk
* @version 1.0
* @since 0.1
*/

public class RotateArray {

	/**.
	* method for rotate array
	* @param array for rotate
	* @return rotate array
	*/
	public int[][] rotate(int[][] array) {
		int x = array.length;
		int[][] antiArray = new int[x][x];
		antiArray[0][x - 1] = array[0][0];
		antiArray[x - 1][x - 1] = array[0][x - 1];
		antiArray[x - 1][0] = array[x - 1][x - 1];
		antiArray[0][0] = array[x - 1][0];
		if (x > 2) {
			antiArray[x - 2][0] = array[x - 1][x - 2];
			antiArray[x - 1][x - 2] = array[x - 2][x - 1];
			antiArray[x - 2][x - 1] = array[0][x - 2];
			antiArray[0][x - 2] = array[x - 2][0];
			antiArray[x - 2][x - 2] = array[x - 2][x - 2];
		}
		return antiArray;
	}
}
@@ -238,17 +238,17 @@
 %7B%0A%09%09int 
-x
+l
  = array
@@ -290,142 +290,115 @@
 int%5B
-x%5D%5Bx
+l%5D%5Bl
 %5D;%0A%09%09
-antiArray%5B0%5D%5Bx - 1%5D = array%5B0%5D%5B0%5D;%0A%09%09antiArray%5Bx - 1%5D%5Bx - 1%5D = array%5B0%5D%5Bx - 1%5D;%0A%09%09antiArray%5Bx - 1%5D%5B0%5D = array%5Bx - 1%5D%5Bx
+for (int x = 0; x %3C l / 2; x++) %7B%0A%09%09%09for (int i = x; i %3C (l - x - 1); i++) %7B%0A%09%09%09%09int j = l
  - 1
-%5D
 ;%0A
+%09%09
 %09%09an
@@ -409,12 +409,12 @@
 ray%5B
-0%5D%5B0
+i%5D%5Bx
 %5D = 
@@ -423,34 +423,20 @@
 ray%5B
-x - 1%5D%5B0
+j - x%5D%5Bi
 %5D;%0A%09
-%09if (x %3E 2) %7B%0A
 %09%09%09a
@@ -444,24 +444,24 @@
 tiArray%5B
-x - 2%5D%5B0
+j - x%5D%5Bi
 %5D = arra
@@ -466,23 +466,24 @@
 ray%5B
-x - 1%5D%5Bx - 2
+j - i%5D%5Bj - x
 %5D;%0A
+%09
 %09%09%09a
@@ -495,20 +495,20 @@
 ray%5B
-x - 1%5D%5Bx - 2
+j - i%5D%5Bj - x
 %5D = 
@@ -518,22 +518,19 @@
 ay%5Bx
- - 2
 %5D%5B
-x - 1
+j - i
 %5D;%0A
+%09
 %09%09%09a
@@ -543,19 +543,15 @@
 ay%5Bx
- - 2
 %5D%5B
-x - 1
+j - i
 %5D = 
@@ -560,60 +560,45 @@
 ray%5B
-0
+i
 %5D%5Bx
- - 2
 %5D;%0A%09%09%09
-antiArray%5B0%5D%5Bx - 2%5D = array%5Bx - 2%5D%5B0%5D;
+%7D%0A%09%09%7D%0A%09%09if ((l %25 2) != 0) %7B
 %0A%09%09%09
@@ -607,26 +607,26 @@
 tiArray%5B
-x -
+l /
  2%5D%5B
-x -
+l /
  2%5D = ar
@@ -633,23 +633,24 @@
 ray%5B
-x -
+l /
  2%5D%5B
-x -
+l /
  2%5D;%0A
+%09
 %09%09%7D%0A

add file for chapter_001_5.1