Java Scanner Read readSystemInToIntArrayList()

Here you can find the source of readSystemInToIntArrayList()

Description

read System In To Int Array List

License

Open Source License

Declaration

public static ArrayList<Integer> readSystemInToIntArrayList() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.Scanner;

public class Main {
    public static ArrayList<Integer> readSystemInToIntArrayList() {
        ArrayList<Integer> array = new ArrayList<Integer>();

        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            array.add(sc.nextInt());/*from w  ww . java2s .c o m*/
        }
        sc.close();

        return array;
    }
}

Related

  1. readInt(String prompt)
  2. readLine(String format, Object... args)
  3. readMatrix(Scanner in, int n)
  4. readPassword(String format, Object... args)
  5. readPositiveInt(String message, Scanner input)
  6. readWholeString(Scanner s)