in one line from the standard input I have 3 types of integers: the first integer is id, the second integer is N - some number, and after that follows N integers, separeted
Use Scanner and method hasNextInt()
Scanner
hasNextInt()
Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { if (scanner.hasNextInt()) { arr[i]=scanner.nextInt(); i++; } }