This the way it works, you have to use a loop structure because the program does not know how many numbers is the user going to input.

Sample:

Code:
import java.util.Scanner; 

public class Digit_Display 
{ 
public static void main(String[] args) 
{ 
Scanner scan = new Scanner(System.in); 

int input = 0; //Stores the input from the user 
String inputAsString = "";
...