can someone help me to solve this issue? Not so sure why I am getting Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
here is the document index I have where the flag is located
Data.csv
docID, docName, docAddress, docPayment, docDate, docFlag
"12|"User"|"park"|"0.0"|"20230217"|""
private DocumentExtract builExtract(String[] documents){
if(documents== null || documents.length <= 0){
return null;
}
DocumentExtract documentExtract= new DocumentExtract();
String flag = documents[5].trim();
if(!flag.isEmpty()){
if(flag.trim().equalsIgnoreCase("false")){
documentExtract.setFlag(false);
}else{
documentExtract.setFlag(true);
}
}else{
documentExtract.setFlag(false);
}
return documentExtract;
DocumentExtract() class
private Boolean flag;
public Boolean getFlag() {
return flag;
}
public void setFlag(Boolean flag) {
this.flag= flag;
}
Hope to learn from people here too, your reply will be highly appreciate