• Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.

User Info: freeballa

freeballa
11 years ago#1
public static int[][] flip(int[][] source) {
int[][] flip = new int [source.length][source[0].length];
for(int y = 0; y < source[0].length; y++){
for(int x = 0; x < source.length; x++){
int temp = 0;

for( int k =0; k < source[0].length/2;k++){
temp = k;
source[k] = source[0][source[0].length-1-k];
source[0][source[0].length-1-k] = temp;
}
}

User Info: Kyoto

Kyoto
11 years ago#2
public static int[][] flip(int[][] source) {

int [][]temp = new int [source.length][source[0].length];

for (int y = 0; y < (source[0].length)/2; y++){
for (int x = 0; x < source.length; x++){
temp [x][y]= source [x][y];
source [x][y] = source [x][source[0].length-1-y];
source [x][source[0].length-1-y] = temp[x][y];
}
}

return source;
}
  • Topic Archived