Here you can find the source of flipLeftToRight(int[][] theArray)
Parameter | Description |
---|---|
theArray | theArray the original block content as matrix |
public static int[][] flipLeftToRight(int[][] theArray)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . j av a 2s . c o m*/ * flip the block from left to right * @param theArray theArray the original block content as matrix * @return */ public static int[][] flipLeftToRight(int[][] theArray) { for (int i = 0; i < theArray.length; i++) { for (int curr = 0; curr < (theArray[0].length + 1) / 2; curr++) { int saved = theArray[i][curr]; theArray[i][curr] = theArray[i][theArray[0].length - 1 - curr]; theArray[i][theArray[0].length - 1 - curr] = saved; } } return theArray; } }