Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- String[][] a = new String[][] {{"A","B","C","D"},{"E","F","G","H"},{"J","K","L","M"},{"N","O","P","Q"}};
- Ausgabe(a);
- Mirror(a);
- Ausgabe(a);
- }
- private static void Ausgabe(String[][] x) {
- for (int i = 0;i < x.length; i++) {
- for (int j = 0; j < x.length; j++) {
- System.out.print(" " + x[i][j] + " ");
- }
- System.out.println();
- }
- }
- private static void Mirror(String[][] x) {
- int ymax = x.length - 1;
- String tmp;
- for (int i = 0; i < x.length; i++) {
- for (int j = 0; j < x.length; j++) {
- if (j > i) {
- tmp = x[i][j];
- x[i][j] = x[ymax - i][ymax - j];
- x[ymax - i][ymax - j] = tmp;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement