title: How to print multi-digit numbers like a 7-segment display
body: <p>I am just wondering whether is it possible to display number in digital format.
  In this we are accepting number from console.</p>
  
  <p>For example:</p>
  
  <pre><code>123 should be display in following format, and in one line.
    _  _
  | _| _|
  | |_ _|
  </code></pre>
  
  <p>I tried using switch case but not got appropriate method</p>
  
  <pre><code>"arg" is char array;
  char c;
  for(i=0;i&lt;3;i++)
  {
  c=arg[i];
  switch(char)
  {
  
      case '1' : System.out.println("|");
                 System.out.println("|");
                 break;
      case '2' : System.out.println("-");
                 System.out.println(" "+"|");
                 System.out.println("-");
                 System.out.println("|");
                 System.out.println("-");
                 break;
  
    same for all digit
  }
  }
  </code></pre>
  
  <p>I know this is not a correct solution to display. </p>
  
  <p>Is it any alternative for this using java.</p>
  
  <p><strong>EDIT</strong>
  Updated code which is suggested by Joe. It works.</p>
  
  <pre><code>        /**
          * @author Amit
          */
          public class DigitalDisplay {
              /**
               * @param args
               */
                  public static void main(String[] args) {
          String [][] num=new String[4][3];
          num[0][0]="|-|";
          num[0][1]="| |";
          num[0][2]="|_|";
  
          num[1][0]=" |";
          num[1][1]=" |";
          num[1][2]=" |";
  
          num[2][0]=" -|";
          num[2][1]=" _|";
          num[2][2]=" |_";
  
          num[3][0]=" -|";
          num[3][1]=" _|";
          num[3][2]=" _|";
          int[] input = {2,1,3}; 
          for (int line = 0; line &lt; 3; line++)
          {          
              for (int inputI=0; inputI &lt; input.length; inputI++)
              {
                  int value = input[inputI];
                  System.out.print(num[value][line]);
                  System.out.print("  ");
              }          
              System.out.println();
          }
      }
  }
  
  **OUTPUT**
  
   -|   |   -|  
   _|   |   _|  
   |_   |   _|  
  </code></pre>
  
  <p>@Joe: Thanks.</p>