Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7972231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:48:40+00:00 2026-06-04T07:48:40+00:00

I am just wondering whether is it possible to display number in digital format.

  • 0

I am just wondering whether is it possible to display number in digital format.
In this we are accepting number from console.

For example:

123 should be display in following format, and in one line.
  _  _
| _| _|
| |_ _|

I tried using switch case but not got appropriate method

"arg" is char array;
char c;
for(i=0;i<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
}
}

I know this is not a correct solution to display.

Is it any alternative for this using java.

EDIT
Updated code which is suggested by Joe. It works.

        /**
        * @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 < 3; line++)
        {          
            for (int inputI=0; inputI < input.length; inputI++)
            {
                int value = input[inputI];
                System.out.print(num[value][line]);
                System.out.print("  ");
            }          
            System.out.println();
        }
    }
}

**OUTPUT**

 -|   |   -|  
 _|   |   _|  
 |_   |   _|  

@Joe: Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:48:41+00:00Added an answer on June 4, 2026 at 7:48 am

    If you have more than one character, you need to scan across each line, building it up.

    All of the following is pseudocode, but I am sure you can translate it into Java. You will need to create a grid and ensure that each digit has the same width and height.

    1 – Set up your initial data for each number. You could do this as a 2d array (dimension 1: digit, dimension 2: line) For example:

    numbers[0][0] = "|-|"
    numbers[0][1] = "| |"
    numbers[0][2] = "|_|"
    
    numbers[1][0] = "  |"
    numbers[1][1] = "  |"
    numbers[1][2] = "  |"
    

    2 – For each line that makes up the character, scan across each digit in your input and write the appropriate string. This will build up the characters line by line.

    input = [1,2,3]
    digit_height = 3
    
    for line digit_height:
       for digit in input:
           print numbers[digit][line]
           print "  " to space between characters
       print new line
    

    Fine, here’s the java:

        int[] input = {2,1,3}; 
        for (int line = 0; line < 3; line++)
        {          
            for (int inputI=0; inputI < input.length; inputI++)
            {
                int value = input[inputI];
                System.out.print(num[value][line]);
                System.out.print("  ");
            }          
            System.out.println();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just wondering whether its possible to have something like this: I have
I was just wondering whether it was possible to do something like this: char
I was just wondering whether it is possible to display my options menu to
I am just wondering whether it is possible to sort by 'combined columns' now
I'm just wondering whether it's possible to create an attribute called alias using FactoryGirl,
just wondering whether it's possible to change the screen timeout using code in Android
Just wondering whether it is possible to convert highly normalized data into binary and
I'm new with Android programming. I'm just wondering whether its possible to set up
Just wondering, will it be possible we can check whether the page is call
Just wondering whether it is possible to update a ByteArray in C Code, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.