[JAVA] Numbers cannot be obtained by division in iterative processing using for

7 3 4 7 1 7 4 5 3 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 I get the error. I don't know the cause, so could you please tell me?

import java.util.Scanner;

public class Cardgame {

public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    String inputStr1 = sc.nextLine();
	String[] dataSet1 = inputStr1.split(" ");
	int suziHennkann1 = Integer.parseInt(dataSet1[0]);
	int suziHennkann2 = Integer.parseInt(dataSet1[1]);
	
	
	String inputStr2 = sc.nextLine();
	int num = Integer.parseInt(inputStr2);
	int[] dataSet3 = new int[num];
	
	for(int i = 0; i < num; i++) {
		String inputStr3 = sc.nextLine();
		String[] dataSet2 = inputStr3.split(" ");
		dataSet3[i] = Integer.parseInt(dataSet2[i]);

Recommended Posts

Numbers cannot be obtained by division in iterative processing using for
Display all in Iterator by iterative processing by while in ArrayList array
When the certificate cannot be obtained by https-portal production (Response Code: 403)