Array*problem sum

can you help with my code--------

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
StringBuilder str1 = new StringBuilder();
StringBuilder str2 = new StringBuilder();
int n1 = cin.nextInt(), arr1[] = new int[n1];
for(int i = 0; i < n1; i++){
arr1[i] = cin.nextInt();
}
int n2 = cin.nextInt(), arr2[] = new int[n2];
for(int i = 0; i < n1; i++){
str1.append(arr1[i]);
}
for(int i = 0; i < n2;i++){
str2.append(arr2[i]);
}
String st1 = str1.toString();
String st2 = str2.toString();
int i1 = Integer.parseInt(st1);
int i2 = Integer.parseInt(st2);
int sum = i1 + i2;
int res[] = new int[10000],i = 0;
while(sum>0){
int d;
d = sum%10;
res[i] = d;
i++;
sum = sum / 10;
}
for(int ar:res){
System.out.print(ar+","+" ");
}
System.out.print(“END”);
cin.close();
}
}

  1. You have not taken input for the second array.

If you use an array, the size will be fixed and all the unused indices will be filled with 0. So, you should always use arraylist when size of answer is unknown.

When you take out d, it is the last digit of your sum, but you are putting is as the first digit of your result array, you you’ll get reverse of your actual answer

what is problem now in my code----------------------