Here you can find the source of shift(int[][] array, boolean inverse)
public static int[][] shift(int[][] array, boolean inverse)
//package com.java2s; //License from project: Apache License public class Main { public static int[][] shift(int[][] array, boolean inverse) { int[][] result = new int[4][4]; for (int i = 0; i < 4; i++) result[i] = shift(array[i], inverse ? i : -i); return result; }// w w w. j a v a2 s . c om public static int[] shift(int[] array, int how) { if (how % array.length == 0) return array; if (how < -array.length) how %= array.length; int[] result = new int[array.length]; for (int i = 0; i < array.length; i++) result[(i + array.length + how) % array.length] = array[i]; return result; } }