Skip to content

Instantly share code, notes, and snippets.

@nhojpatrick
Created June 13, 2016 20:09
Show Gist options
  • Save nhojpatrick/f701c397a430cb5f90acbc7e38d096d2 to your computer and use it in GitHub Desktop.
Save nhojpatrick/f701c397a430cb5f90acbc7e38d096d2 to your computer and use it in GitHub Desktop.
public class ArrayTest {
public static void main(final String[] args) {
final int D1 = 5;
final int D2 = 4;
int[][] table = new int[D1][D2];
for (int i = 0; i < table.length; i++) {
for (int j = 0; j < table[i].length; j++) {
if (i == j) {
table[i][j] = 1;
} else {
table[i][j] = 0;
}
System.out.print(table[i][j]);
}
System.out.print("\n");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment