List of utility methods to do Array Flip
String[][] | flip(String[][] data) flip String[][] flipped = new String[data[0].length][data.length]; for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[i].length; j++) { flipped[j][i] = data[i][j]; return flipped; |
T[] | flip(T[] array) flip T[] tmp = array.clone(); for (int i = 0; i < array.length; i++) { tmp[i] = array[array.length - i]; return tmp; |
byte[] | flipAllBits(byte[] bytes) flip All Bits return flipAllBits(bytes, 0);
|
byte[] | flipAllBitsInPlace(byte[] bytes) This flips the bits and returns the same byte[]. return flipAllBitsInPlace(bytes, 0, bytes.length);
|
int[] | flipChessboardVertically(int[] chessboard) flip Chessboard Vertically int len = chessboard.length; int[] newChessboard = new int[len]; for (int i = 0; i < len; i++) { newChessboard[i] = chessboard[len - 1 - i]; return newChessboard; |