Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Implement a method: mirrorDiagonal(int[][] arr), which takes an array with the same width and height, and mirror the right upper part to the left bottom corner.
- For example:
- The original array:
- 1 2 3 4 5
- 0 2 3 4 5
- 0 0 3 4 5
- 0 0 0 4 5
- 0 0 0 0 5
- After calling mirrorDiagonal(arr), the array will become:
- 1 2 3 4 5
- 2 2 3 4 5
- 3 3 3 4 5
- 4 4 4 4 5
- 5 5 5 5 5
- Your code shall have this format:
- public class Unit601_initials {
- public static void main(String[] args) {
- int[][] att = { {1, 2, 3, 4, 5}, {0, 2, 3, 4, 5}, {0, 0, 3, 4, 5}, {0, 0, 0, 4, 5}, {0, 0, 0, 0, 5} };
- mirrorDiaganol(att);
- //rto do: code to print the array.
- }
- public static void mirrorDiaganol(int[][] arr) {
- // to do:
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement