Skip to content

Instantly share code, notes, and snippets.

@KushalP
Last active August 29, 2015 14:16
Show Gist options
  • Save KushalP/d4bd195698faa4c7055e to your computer and use it in GitHub Desktop.
Save KushalP/d4bd195698faa4c7055e to your computer and use it in GitHub Desktop.
class UserInput {
public static void main(String[] args) {
// Create a two dimensional array to hold user input. Using
// a boolean because we only care about there being
// "user input" present or not.
boolean[][] inputs = new boolean[18][28];
// Set some values to show where user input has been triggered.
inputs[1][17] = true;
inputs[5][4] = true;
inputs[16][18] = true;
for (boolean[] row : inputs) {
for (boolean column : row) {
if (column == true) {
System.out.print(1);
} else {
System.out.print(0);
}
}
// Add a line break after printing every row.
System.out.println("");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment