fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. final int width = 3;
  11. final int height = 3;
  12. int tablica[][] = new int[width][height];
  13. int currentX = 0;
  14. int currentY = 0;
  15.  
  16. /**
  17.   * @param args the command line arguments
  18.   * 0 1 2
  19.   * 0 [0][1][3]
  20.   * 1 [2][4][6]
  21.   * 2 [5][7][8]
  22.   */
  23. public static void main(String[] args) {
  24. new Ideone().run();
  25. }
  26.  
  27. private void run() {
  28. clearTable();
  29. computeNumbers();
  30. printTable();
  31. }
  32.  
  33. void computeNumbers() {
  34. currentX = 0;
  35. currentY = 0;
  36. for(int i=0; i< width*height; i++){
  37. findPlaceForIndex(i);
  38. }
  39. }
  40.  
  41. private void findPlaceForIndex(int i) {
  42. //TODO
  43. }
  44.  
  45. void printTable() {
  46. for(int i=0; i< 3; i++){
  47. for(int j=0; j<3; j++){
  48. System.out.print(tablica[i][j] +" ");
  49. }
  50. System.out.println("");
  51. }
  52. }
  53.  
  54. private void clearTable() {
  55. for(int i=0; i< width; i++){
  56. for(int j=0; j< height; j++){
  57. tablica[i][j] = 0;
  58. }
  59. }
  60. }
  61. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
0 0 0 
0 0 0 
0 0 0