I think this must solve your problem...
public class AddArray {
public static void main( String[] args ) {
int a[] = {2,3,5,6,7,8,9}; // Could be n size going thru the list
int b[] = {5,7,2,9}; // also could be n size
if(a.length>b.length){
int temp=b.length;
for(int i=0;i<a.length;i++){
if(temp!=0){
System.out.println(a[i]+b[i]);
temp--;
}else{
System.out.println(a[i]);
}
}
}else{
int temp=a.length;
for(int i=0;i<b.length;i++){
if(temp!=0){
System.out.println(a[i]+b[i]);
temp--;
}else{
System.out.println(b[i]);
}
}
}
}
}