Check out example codes for "how to get multiple integer input in java". It will help you in understanding the concepts better.

Code Example 1

Scanner scanner = new Scanner(System.in);

    while(scanner.hasNext())
    {
        System.out.println(scanner.nextInt());
    }

Code Example 2

String input = scanner.nextLine();    // get the entire line after the prompt 
String[] numbers = input.split(" "); // split by spaces

Learn ReactJs, React Native from akashmittal.com