Java Matrix Flip flipInPlace(int[][] theArray)

Here you can find the source of flipInPlace(int[][] theArray)

Description

returns the flipping of entire block/piece

License

Open Source License

Parameter

Parameter Description
theArray the original block content as matrix

Declaration

public static int[][] flipInPlace(int[][] theArray) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from w  ww.j  a  v  a 2  s .  co m*/
     * returns the flipping of entire block/piece
     * @param theArray the original block content as matrix
     * @return
     */
    public static int[][] flipInPlace(int[][] theArray) {
        for (int i = 0; i < (theArray.length / 2); i++) {
            int[] temp = theArray[i];
            theArray[i] = theArray[theArray.length - i - 1];
            theArray[theArray.length - i - 1] = temp;
        }
        return theArray;
    }
}

Related

  1. flipLeftToRight(int[][] theArray)
  2. flipLR(int[][] x)
  3. flipOverX(T[][] arr)
  4. flipOverY(T[][] arr)