Question
In java run through eclipse /** * * Given a square array, determines if it is diagonal * That is, returns true if all values
In java run through eclipse
/** * * Given a square array, determines if it is diagonal * That is, returns true if all values in the array are 0 * except the main diagonal. The main diagonal is entries of the form * data[i][j] where i == j. Elements on the main * diagonal can be 0 or any other number. * * Examples: * {{1,0,0}, * {0,2,0} * {0,0,3}} yields true * * {{1,0,9}, * {0,2,0}, * {0,0,3}} yields false because 0,2 is nonzero * * {{0,0,0}, * {0,0,0}, * {0,0,3}} yields true because there can be 0 * entries on the diagonal if desired * @param data input array * @return true if it is diagonal, false otherwise */ public static boolean isDiagonal(int[][] data) { return false; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started